-
Notifications
You must be signed in to change notification settings - Fork 0
/
Setup.frm
781 lines (601 loc) · 19.3 KB
/
Setup.frm
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
VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} Setup
Caption = "Настройки"
ClientHeight = 5895
ClientLeft = 45
ClientTop = 330
ClientWidth = 8400
OleObjectBlob = "Setup.frx":0000
StartUpPosition = 1 'CenterOwner
End
Attribute VB_Name = "Setup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Read As Integer
Dim Detonate As Integer
' ##############################################Start WorkersTab surr###############################
Function wRecordInfo(ID)
'On Error GoTo Endd
Read = 1
If NameChooser.Value <> BaseName_Box.Value Then wUpdateBaseName
NameChooser.Value = BaseName_Box.Value
WorkersProcess (ID)
ScanWorkers (WorkersBase)
Endd:
Read = 0
End Function
Function ScanWorkers(Fil)
'On Error GoTo Start
Windows(Fil).Activate
Setup.WorkersTree.Visible = True
Setup.WorkersTreeHolder.Visible = True
Setup.WorkersTree.Nodes.Clear
Sheets("Каталог").Select
Total = Cells(4, 23).Value
For i = InfoOffset To CInt(InfoOffset - 1 + Total)
Setup.WorkersTree.Nodes.Add(, , CStr(Cells(i, 24)) & "z", Cells(i, 23).Value).Sorted = True
Setup.WorkersTree.Nodes(i - InfoOffset + 1).Tag = "Cat"
Next
Sheets("Сотрудники").Select
WeHaveWorkers = Cells(1, 2).Value
For i = 3 To WeHaveWorkers + 3
For p = 1 To Total
If Setup.WorkersTree.Nodes(p).Key = CStr(Cells(i, 6).Value) & "z" Then
Setup.WorkersTree.Nodes.Add(p, 4, Cells(i, 3), _
Cells(i, 2) & " " & Cells(i, 5)).Sorted = True
End If
Next p
Next i
p = 1
Do While p < Setup.WorkersTree.Nodes.Count
If Setup.WorkersTree.Nodes(p).Children = 0 And Setup.WorkersTree.Nodes(p).Tag = "Cat" Then
Setup.WorkersTree.Nodes.Remove (p)
p = p - 1
Total = Total - 1
End If
p = p + 1
Loop
Setup.WorkersTree.Tag = Total
'Setup.WorkersTree.Visible = False
Setup.WorkersTreeHolder.Visible = False
GoTo Endd:
Start:
Exception.Show
Endd:
End Function
Function wReadLockedInfo()
'On Error GoTo Endd
ID = GetWorkerID(NameChooser.Value)
Read = 1
LastName_Box.Value = Cells(ID, 2).Value
wCatChooser.Value = wCatChooser.List(Cells(ID, 6).Value - InfoOffset)
Names_Box.Value = Cells(ID, 5).Value
NewPin_Box.Value = ""
BaseName_Box.Value = NameChooser.Value
isHidden_wmark.Value = Cells(ID, 4)
Read = 0
Endd:
End Function
Function WorkersProcess(ID)
Sheets("Сотрудники").Select
Cells(ID, 2).Value = LastName_Box.Value
Cells(ID, 3).Value = BaseName_Box.Value
Cells(ID, 6).Value = wCatChooser.ListIndex + InfoOffset
Cells(ID, 5).Value = Names_Box.Value
If NewPin_Box.Value <> "" Then Cells(ID, 7).Value = BlockIt.CalcStr(NewPin_Box.Value)
NewPin_Box.Value = ""
If isHidden_wmark.Value = True Then Cells(ID, 4).Value = 1 _
Else Cells(ID, 4).Value = 0
Sheets(BaseName_Box.Value).Select
Cells(1, 2).Value = LastName_Box.Value
Cells(2, 2).Value = Names_Box.Value
'Cells(1, 4).Value = wCatChooser.ListIndex + InfoOffset
'If isHidden_wmark.Value = True Then Cells(2, 1).Value = 1 _
Else Cells(2, 1).Value = 0
End Function
Function wUpdateBaseName()
Sheets("Сотрудники").Select
ID = GetWorkerID(NameChooser.Value)
Cells(ID, 3).Value = BaseName_Box.Value
ActiveWorkbook.Sheets(NameChooser.Value).Name = BaseName_Box.Value
End Function
Private Sub BaseName_Box_Change()
If (BaseName_Box.Value <> "") And (BaseName_Box.Value <> NameChooser.Value) Then _
wAdd_Button.Enabled = True
If BaseName_Box.Value = NameChooser.Value Then wAdd_Button.Enabled = False
End Sub
Private Sub CommandButton1_Click()
FineTuning_Main.Show
End Sub
Private Sub wAdd_Button_Click()
If CheckBaseName(0) = 0 Then
Read = 1
Sheets("Образец").Select
Sheets("Образец").Copy After:=Sheets(ActiveWorkbook.Sheets.Count)
ActiveWorkbook.Sheets(ActiveWorkbook.Sheets.Count).Name = BaseName_Box.Value
Sheets("Сотрудники").Select
ID = Cells(1, 2).Value + 3
Cells(1, 2).Value = Cells(1, 2).Value + 1
WorkersProcess (ID)
ScanWorkers (WorkersBase)
NameChooser.Value = BaseName_Box.Value
Read = 0
wAdd_Button.Enabled = False
End If
End Sub
Private Sub wChange_Button_Click()
ID = GetWorkerID(NameChooser.Value)
If CheckBaseName(ID) = 0 Then wRecordInfo (ID)
End Sub
Function CheckBaseName(ExcludePosition)
CheckBaseName = 0
Sheets("Сотрудники").Select
WeHaveWorkers = Cells(1, 2).Value
For i = 3 To WeHaveWorkers + 3
If BaseName_Box.Value = Cells(i, 3).Value And i <> ExcludePosition Then
CheckBaseName = 1
i = WeHaveWorkers + 4
End If
Next
End Function
Private Sub WorkersTree_DblClick()
If WorkersTree.SelectedItem.Key <> "" And WorkersTree.SelectedItem.Tag <> "Cat" Then
NameChooser.Value = WorkersTree.SelectedItem.Key
WorkersTreeHolder.Visible = False
End If
End Sub
Private Sub NameChooser_Change()
If Read = 0 Then wReadLockedInfo
End Sub
Private Sub ChooseWorker_Click()
'For i = 1 To CInt(WorkersTree.Tag)
' If WorkersTree.Nodes(i).Tag = "Cat" Then _
' WorkersTree.Nodes(i).Expanded = False
' Next
'WorkersTree.Visible = True
WorkersTreeHolder.Visible = True
WorkersTree.SetFocus
End Sub
Private Sub Frame3_Click()
WorkersTreeHolder.Visible = False
End Sub
Private Sub LastName_Box_Change()
If Read = 0 Then BaseName_Box.Value = LastName_Box.Value
End Sub
''################################### End WorkersTab Surr _#####################################################
''################################### Start WCatTab Surr _#####################################################
Function GetWCatID(CatName)
Sheets("Каталог").Select
Total = Cells(4, 23).Value
For i = InfoOffset To CInt(InfoOffset - 1 + Total)
If Cells(i, 23).Value = CatName Then
GetWCatID = CInt(Cells(i, 24).Value)
i = 1 + CInt(InfoOffset - 1 + Total)
End If
Next
If CatName = "" Then GetWCatID = 1
End Function
Function ScanWCats()
Sheets("Каталог").Select
Setup.cCatChooser.Clear
Setup.wCatChooser.Clear
Total = Cells(4, 23).Value
For i = InfoOffset To CInt(InfoOffset - 1 + Total)
Setup.cCatChooser.AddItem (Cells(i, 23).Value)
Setup.wCatChooser.AddItem (Cells(i, 23).Value)
Next
End Function
Function wcReadLockedInfo()
On Error GoTo Endd
ID = GetWCatID(cCatChooser.Value)
CatName_Box.Value = cCatChooser.Value
Endd:
End Function
Private Sub CatName_Box_Change()
If (CatName_Box.Value <> "") And (CatName_Box.Value <> cCatChooser.Value) Then cAdd_Button.Enabled = True
If CatName_Box.Value = cCatChooser.Value Then cAdd_Button.Enabled = False
End Sub
Private Sub CatSpin_SpinUp()
If cCatChooser.ListIndex > 0 Then _
cCatChooser.Value = cCatChooser.List(cCatChooser.ListIndex - 1)
End Sub
Private Sub CatSpin_SpinDown()
If cCatChooser.ListIndex < cCatChooser.ListCount - 1 Then _
cCatChooser.Value = cCatChooser.List(cCatChooser.ListIndex + 1)
End Sub
Private Sub cCatChooser_Change()
If Read = 0 Then wcReadLockedInfo
End Sub
Function ProcessWCat(ID)
Read = 1
Cells(ID, 23).Value = CatName_Box.Value
Cells(ID, 24).Value = ID
ScanWCats
ScanWorkers (WorkersBase)
Read = 0
cCatChooser.Value = CatName_Box.Value
End Function
Function UpdateWCatName()
Read = 1
ID = GetWCatID(cCatChooser.Value)
Cells(ID, 23).Value = CatName_Box.Value
Read = 0
End Function
Private Sub cChange_Button_Click()
If CatName_Box.Value <> cCatChooser.Value Then UpdateWCatName
ProcessWCat (GetWCatID(CatName_Box.Value))
End Sub
Private Sub cAdd_Button_Click()
Read = 1
ID = Cells(4, 23).Value + InfoOffset
Cells(4, 23).Value = Cells(4, 23).Value + 1
ProcessWCat (ID)
Read = 0
cAdd_Button.Enabled = False
End Sub
''################################### End WCatTab Surr _#####################################################
''################################### Start JobTab Surr _#####################################################
Function ScanJobs()
Sheets("Каталог").Select
Setup.JobsTree.Visible = True
Setup.JobsTreeHolder.Visible = True
Setup.JobsTree.Nodes.Clear
TotalCat = Cells(4, 19).Value
For i = InfoOffset To CInt(InfoOffset - 1 + TotalCat)
Setup.JobsTree.Nodes.Add(, , , Cells(i, 19).Value).Sorted = True
Setup.JobsTree.Nodes(i - InfoOffset + 1).Tag = "Cat"
Next
Total = Cells(4, 2).Value
For i = InfoOffset To CInt(InfoOffset - 1 + Total)
' If Cells(i, 7) = 0 Then
Setup.JobsTree.Nodes.Add(CInt(Cells(i, 1).Value - InfoOffset + 1), 4, CStr(Cells(i, 3)) & "z", Cells(i, 2).Value).Sorted = True
Next
p = 1
Do While p < Setup.JobsTree.Nodes.Count
If Setup.JobsTree.Nodes(p).Children = 0 And Setup.JobsTree.Nodes(p).Tag = "Cat" Then
Setup.JobsTree.Nodes.Remove (p)
TotalCat = TotalCat - 1
p = p - 1
End If
p = p + 1
Loop
Setup.JobsTree.Tag = TotalCat
Setup.JobsTreeHolder.Visible = False
End Function
Private Sub Frame1_Click()
Setup.JobsTreeHolder.Visible = False
End Sub
Function jReadLockedInfo()
'On Error GoTo Endd
Sheets("Каталог").Select
ID = jID.Value
JobName_Box.Value = Cells(ID, 2).Value
CatChooser.Value = CatChooser.List(Cells(ID, 1).Value - 6)
Unit_Box.Value = Cells(ID, 4).Value
UnitRate_Box.Value = Cells(ID, 5)
TimeRate_Box.Value = Cells(ID, 6)
isHidden_jMark.Value = Cells(ID, 7).Value
OnSale_Mark.Value = Cells(ID, 8).Value
OnReport_Mark.Value = Cells(ID, 9).Value
Price.Value = Cells(ID, 10).Value
Endd:
End Function
Function ProcessJobs(ID)
Cells(ID, 2).Value = JobName_Box.Value
Cells(ID, 4).Value = Unit_Box.Value
Cells(ID, 5) = UnitRate_Box.Value
Cells(ID, 6) = TimeRate_Box.Value
Cells(ID, 1) = InfoOffset + CatChooser.ListIndex
Cells(ID, 10).Value = Price.Value
If isHidden_jMark.Value = False Then Cells(ID, 7).Value = 0 _
Else Cells(ID, 7).Value = 1
If OnSale_Mark.Value = False Then Cells(ID, 8).Value = 0 _
Else Cells(ID, 8).Value = 1
If OnReport_Mark.Value = False Then Cells(ID, 9).Value = 0 _
Else Cells(ID, 9).Value = 1
End Function
Private Sub ChooseJob_Click()
'For i = 1 To CInt(JobsTree.Tag)
' If JobsTree.Nodes(i).Tag = "Cat" Then _
' JobsTree.Nodes(i).Expanded = False
'Next
Frame4.Visible = False
JobsTreeHolder.Visible = True
JobsTree.SetFocus
End Sub
Private Sub JobName_Box_Change()
If (JobName_Box.Value <> "") Then jAdd_Button.Enabled = True
End Sub
Private Sub jID_Change()
If Read = 0 Then jReadLockedInfo
End Sub
Private Sub JobsTree_DblClick()
If JobsTree.SelectedItem.Key <> "" Then
jID.Value = CutZ(JobsTree.SelectedItem.Key)
JobsTreeHolder.Visible = False
End If
jAdd_Button.Enabled = False
End Sub
Private Sub TimeRate_Box_Change()
If TimeRate_Box.Value <> "" Then TimeRate_Box.Value = PointFilter(TimeRate_Box.Value, True, True)
If Detonate = 0 Then
Detonate = 1
UnitRate_Box.Value = "0"
Detonate = 0
End If
End Sub
Private Sub UnitRate_Box_Change()
If UnitRate_Box.Value <> "" Then UnitRate_Box.Value = PointFilter(UnitRate_Box.Value, True, True)
If Detonate = 0 Then
Detonate = 1
TimeRate_Box.Value = "0"
Detonate = 0
End If
End Sub
Private Sub JobSpin_SpinUp()
If JobChooser.ListIndex > 0 Then _
JobChooser.Value = JobChooser.List(JobChooser.ListIndex - 1)
End Sub
Private Sub JobSpin_SpinDown()
If JobChooser.ListIndex < JobChooser.ListCount - 1 Then _
JobChooser.Value = JobChooser.List(JobChooser.ListIndex + 1)
End Sub
Private Sub OnSale_Mark_Change()
If OnSale_Mark.Value = True Then Frame4.Visible = True
If OnSale_Mark.Value = False Then Frame4.Visible = False
End Sub
Private Sub Price_Change()
If Price.Value <> "" Then Price.Value = PointFilter(Price.Value)
End Sub
Private Sub jChange_Button_Click()
ProcessJobs (jID.Value)
ScanJobs
End Sub
Private Sub jAdd_Button_Click()
Read = 1
Sheets("Каталог").Select
ID = Cells(4, 2).Value + InfoOffset
ProcessJobs (ID)
Cells(ID, 3).Value = ID
Cells(ID, 2).Value = JobName_Box.Value
Cells(4, 2).Value = Cells(4, 2).Value + 1
ScanJobs
Read = 0
jAdd_Button.Enabled = False
jID.Value = ID
Endd:
End Sub
''################################### Start JCatTab Surr _#####################################################
Function jGetCatID(CatName)
Sheets("Каталог").Select
Total = Cells(4, 19).Value
For i = 6 To CInt(5 + Total)
If Cells(i, 19).Value = CatName Then
jGetCatID = CInt(Cells(i, 20).Value)
i = 1 + CInt(5 + Total)
End If
Next
If CatName = "" Then jGetCatID = 1
End Function
Function ScanJCats()
On Error GoTo Start
Setup.CatChooser.Clear
Setup.jCatChooser.Clear
Sheets("Каталог").Select
Total = Cells(4, 19).Value
For i = 6 To CInt(5 + Total)
Setup.CatChooser.AddItem (Cells(i, 19).Value)
Setup.jCatChooser.AddItem (Cells(i, 19).Value)
Next
GoTo Endd:
Start:
Exception.Show
Endd:
End Function
Private Sub jCatName_Box_Change()
If (jCatName_Box.Value <> "") And (jCatName_Box.Value <> jCatChooser.Value) Then jcAdd_Button.Enabled = True
If jCatName_Box.Value = jCatChooser.Value Then jcAdd_Button.Enabled = False
End Sub
Private Sub jCatChooser_Change()
If Read = 0 Then jCatName_Box.Value = jCatChooser.Value
End Sub
Function ReInit()
ScanJCats
ScanJobs
Setup.jCatChooser.Value = jCatName_Box.Value
End Function
Private Sub jcChange_Button_Click()
If jCatChooser.Value <> jCatName_Box.Value Then UpdateJCatName
Read = 1
ReInit
Read = 0
End Sub
Private Sub jCatSpin_SpinUp()
If jCatChooser.ListIndex > 0 Then _
jCatChooser.Value = jCatChooser.List(jCatChooser.ListIndex - 1)
End Sub
Private Sub jCatSpin_SpinDown()
If jCatChooser.ListIndex < jCatChooser.ListCount - 1 Then _
jCatChooser.Value = jCatChooser.List(jCatChooser.ListIndex + 1)
End Sub
Private Sub jcAdd_Button_Click()
Read = 1
ID = Cells(4, 19).Value + 5 + 1
Cells(ID, 19).Value = jCatName_Box.Value
Cells(ID, 20).Value = ID
Cells(4, 19).Value = Cells(4, 19).Value + 1
ReInit
jcAdd_Button.Enabled = False
Read = 0
End Sub
Function UpdateJCatName()
Read = 1
ID = jGetCatID(jCatChooser.Value)
Cells(ID, 19).Value = jCatName_Box.Value
ReInit
Read = 0
End Function
''################################### Stop JCatTab Surr _#####################################################
''################################### Start OCatTab Surr _#####################################################
Function oGetCatID(CatName)
Sheets("Каталог").Select
Total = Cells(4, 31).Value
For i = 6 To CInt(5 + Total)
If Cells(i, 31).Value = CatName Then
oGetCatID = CInt(Cells(i, 32).Value)
i = 1 + CInt(5 + Total)
End If
Next
If CatName = "" Then oGetCatID = 1
End Function
Function ScanOCats()
On Error GoTo Start
Setup.OrgChooser.Clear
Setup.oCatChooser.Clear
Sheets("Каталог").Select
Total = Cells(4, 31).Value
For i = 6 To CInt(5 + Total)
Setup.OrgChooser.AddItem (Cells(i, 31).Value)
Setup.oCatChooser.AddItem (Cells(i, 31).Value)
Next
GoTo Endd:
Start:
Exception.Show
Endd:
End Function
Private Sub oCatName_Box_Change()
If (oCatName_Box.Value <> "") And (oCatName_Box.Value <> oCatChooser.Value) Then ocAdd_Button.Enabled = True
If oCatName_Box.Value = oCatChooser.Value Then ocAdd_Button.Enabled = False
End Sub
Private Sub oCatChooser_Change()
If Read = 0 Then oCatName_Box.Value = oCatChooser.Value
End Sub
Function oReInit()
ScanOCats
ScanOrgs
Setup.oCatChooser.Value = oCatName_Box.Value
End Function
Private Sub ocChange_Button_Click()
If oCatChooser.Value <> oCatName_Box.Value Then UpdateOCatName
Read = 1
oReInit
Read = 0
End Sub
Function UpdateOCatName()
Read = 1
ID = oGetCatID(oCatChooser.Value)
Cells(ID, 31).Value = oCatName_Box.Value
oReInit
Read = 0
End Function
Private Sub oCatSpin_SpinUp()
If oCatChooser.ListIndex > 0 Then _
oCatChooser.Value = oCatChooser.List(oCatChooser.ListIndex - 1)
End Sub
Private Sub oCatSpin_SpinDown()
If oCatChooser.ListIndex < oCatChooser.ListCount - 1 Then _
oCatChooser.Value = oCatChooser.List(oCatChooser.ListIndex + 1)
End Sub
Private Sub ocAdd_Button_Click()
Read = 1
ID = Cells(4, 31).Value + 5 + 1
Cells(ID, 31).Value = oCatName_Box.Value
Cells(ID, 32).Value = ID
Cells(4, 31).Value = Cells(4, 31).Value + 1
oReInit
ocAdd_Button.Enabled = False
Read = 0
End Sub
''################################### Stop JCatTab Surr _#####################################################
''################################### Start OgrTab Surr _#####################################################
Function ScanOrgs()
Sheets("Каталог").Select
Setup.OrgsTree.Visible = True
Setup.OrgsTreeHolder.Visible = True
Setup.OrgsTree.Nodes.Clear
TotalCat = Cells(4, 31).Value
For i = InfoOffset To CInt(InfoOffset - 1 + TotalCat)
Setup.OrgsTree.Nodes.Add(, , , Cells(i, 31).Value).Sorted = True
Setup.OrgsTree.Nodes(i - InfoOffset + 1).Tag = "Cat"
Next
Total = Cells(4, 27).Value
For i = InfoOffset To CInt(InfoOffset - 1 + Total)
' If Cells(i, 7) = 0 Then
Setup.OrgsTree.Nodes.Add(CInt(Cells(i, 28).Value - InfoOffset + 1), 4, CStr(Cells(i, 25)) & "z", Cells(i, 27).Value).Sorted = True
Next
p = 1
Do While p < Setup.OrgsTree.Nodes.Count
If Setup.OrgsTree.Nodes(p).Children = 0 And Setup.OrgsTree.Nodes(p).Tag = "Cat" Then
Setup.OrgsTree.Nodes.Remove (p)
TotalCat = TotalCat - 1
p = p - 1
End If
p = p + 1
Loop
Setup.OrgsTree.Tag = TotalCat
Setup.OrgsTreeHolder.Visible = False
End Function
Private Sub Frame7_Click()
Setup.OrgsTreeHolder.Visible = False
End Sub
Function oReadLockedInfo()
'On Error GoTo Endd
Sheets("Каталог").Select
ID = oID.Value
OrgName_Box.Value = Cells(ID, 27).Value
OrgChooser.Value = OrgChooser.List(Cells(ID, 28).Value - 6)
isHidden_oMark.Value = Cells(ID, 26).Value
Endd:
End Function
Function ProcessOrgs(ID)
Cells(ID, 27).Value = OrgName_Box.Value
Cells(ID, 28) = InfoOffset + OrgChooser.ListIndex
If isHidden_oMark.Value = False Then Cells(ID, 26).Value = 0 _
Else Cells(ID, 26).Value = 1
End Function
Private Sub ChooseOrg_Click()
'For i = 1 To CInt(JobsTree.Tag)
' If JobsTree.Nodes(i).Tag = "Cat" Then _
' JobsTree.Nodes(i).Expanded = False
'Next
OrgsTreeHolder.Visible = True
OrgsTree.SetFocus
End Sub
Private Sub OrgName_Box_Change()
If (OrgName_Box.Value <> "") Then oAdd_Button.Enabled = True
End Sub
Private Sub oID_Change()
If Read = 0 Then oReadLockedInfo
End Sub
Private Sub OrgsTree_DblClick()
If OrgsTree.SelectedItem.Key <> "" Then
oID.Value = CutZ(OrgsTree.SelectedItem.Key)
OrgsTreeHolder.Visible = False
End If
oAdd_Button.Enabled = False
End Sub
Private Sub oChange_Button_Click()
ProcessOrgs (oID.Value)
ScanOrgs
End Sub
Private Sub oAdd_Button_Click()
Read = 1
Sheets("Каталог").Select
ID = Cells(4, 27).Value + InfoOffset
ProcessOrgs (ID)
Cells(ID, 25).Value = ID
Cells(ID, 27).Value = OrgName_Box.Value
Cells(4, 27).Value = Cells(4, 27).Value + 1
ScanOrgs
Read = 0
oAdd_Button.Enabled = False
oID.Value = ID
Endd:
End Sub
Private Sub UserForm_Click()
WorkersTree.Visible = False
JobsTree.Visible = False
OrgsTree.Visible = False
End Sub