This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmLetter.frm
612 lines (571 loc) · 17.6 KB
/
frmLetter.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
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "msdatlst.ocx"
Begin VB.Form frmLetter
BorderStyle = 1 'Fixed Single
Caption = "Letter"
ClientHeight = 8760
ClientLeft = 45
ClientTop = 435
ClientWidth = 12435
BeginProperty Font
Name = "Tahoma"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 8760
ScaleWidth = 12435
Begin VB.Timer Timer1
Left = 8760
Top = 840
End
Begin VB.CommandButton Command1
Caption = "C&lose"
Height = 495
Left = 11040
TabIndex = 39
Top = 8040
Width = 1215
End
Begin VB.TextBox txtLetterID
Height = 375
Left = 6840
TabIndex = 38
Top = 600
Visible = 0 'False
Width = 735
End
Begin VB.Frame Frame3
Caption = "Replied"
Height = 1215
Left = 6240
TabIndex = 31
Top = 6720
Width = 6015
Begin VB.TextBox txtReplyComments
Height = 375
Left = 1800
TabIndex = 33
Top = 720
Width = 4095
End
Begin VB.CheckBox chkReplied
Caption = "Replied"
Height = 255
Left = 120
TabIndex = 32
Top = 240
Width = 1455
End
Begin MSComCtl2.DTPicker dtpReplied
Height = 375
Left = 1800
TabIndex = 34
Top = 240
Width = 2895
_ExtentX = 5106
_ExtentY = 661
_Version = 393216
CustomFormat = "dd MMMM yyyy"
Format = 16449539
CurrentDate = 40940
End
Begin VB.Label Label2
Caption = "Comments"
Height = 375
Left = 120
TabIndex = 35
Top = 720
Width = 2055
End
End
Begin VB.Frame Frame2
Caption = "Complete"
Height = 1215
Left = 6240
TabIndex = 25
Top = 5520
Width = 6015
Begin VB.CheckBox chkCompleted
Caption = "Completed"
Height = 255
Left = 120
TabIndex = 27
Top = 240
Width = 1455
End
Begin VB.TextBox txtCompleteComments
Height = 375
Left = 1800
TabIndex = 26
Top = 720
Width = 4095
End
Begin MSComCtl2.DTPicker dtpComplete
Height = 375
Left = 1800
TabIndex = 28
Top = 240
Width = 2895
_ExtentX = 5106
_ExtentY = 661
_Version = 393216
CustomFormat = "dd MMMM yyyy"
Format = 16449539
CurrentDate = 40940
End
Begin VB.Label Label4
Caption = "Comments"
Height = 375
Left = 120
TabIndex = 29
Top = 720
Width = 2055
End
End
Begin VB.Frame Frame1
Caption = "Assign"
Height = 2415
Left = 120
TabIndex = 17
Top = 5520
Width = 6015
Begin VB.CheckBox chkAssigned
Caption = "Assigned"
Height = 255
Left = 120
TabIndex = 30
Top = 240
Width = 1455
End
Begin VB.TextBox txtAssignComments
Height = 615
Left = 1800
TabIndex = 23
Top = 1200
Width = 4095
End
Begin VB.CheckBox chkCompleteBy
Caption = "Complete By"
Height = 255
Left = 120
TabIndex = 21
Top = 1920
Width = 1455
End
Begin MSComCtl2.DTPicker dtpAssigned
Height = 375
Left = 1800
TabIndex = 19
Top = 240
Width = 2895
_ExtentX = 5106
_ExtentY = 661
_Version = 393216
CustomFormat = "dd MMMM yyyy"
Format = 16449539
CurrentDate = 40940
End
Begin MSDataListLib.DataCombo cmbAssigner
Height = 360
Left = 1800
TabIndex = 20
Top = 720
Width = 4095
_ExtentX = 7223
_ExtentY = 635
_Version = 393216
Text = ""
End
Begin MSComCtl2.DTPicker dtpCompleteBy
Height = 375
Left = 1800
TabIndex = 22
Top = 1920
Width = 2895
_ExtentX = 5106
_ExtentY = 661
_Version = 393216
CustomFormat = "dd MMMM yyyy"
Format = 16449539
CurrentDate = 40940
End
Begin VB.Label lblNewAssigner
Height = 375
Left = 4800
TabIndex = 37
Top = 240
Width = 1095
End
Begin VB.Label Label3
Caption = "Comments"
Height = 375
Left = 120
TabIndex = 24
Top = 1200
Width = 2055
End
Begin VB.Label Label1
Caption = "Assigned To"
Height = 375
Left = 120
TabIndex = 18
Top = 720
Width = 2655
End
End
Begin VB.CheckBox chkReply
Caption = "Reply By"
Height = 255
Left = 120
TabIndex = 4
Top = 5040
Width = 1455
End
Begin VB.TextBox txtContent
Height = 1935
Left = 1800
MultiLine = -1 'True
TabIndex = 3
Top = 2520
Width = 7575
End
Begin VB.TextBox txtLetterNo
Height = 375
Left = 1800
TabIndex = 2
Top = 1560
Width = 7575
End
Begin VB.TextBox txtTopic
Height = 375
Left = 1800
TabIndex = 1
Top = 2040
Width = 7575
End
Begin VB.CommandButton btnSave
Caption = "Save"
Height = 495
Left = 9720
TabIndex = 0
Top = 8040
Width = 1215
End
Begin MSComCtl2.DTPicker dtpReplyBefore
Height = 375
Left = 1800
TabIndex = 5
Top = 5040
Width = 2895
_ExtentX = 5106
_ExtentY = 661
_Version = 393216
CustomFormat = "dd MMMM yyyy"
Format = 16449539
CurrentDate = 40940
End
Begin MSComCtl2.DTPicker dtpLetterDate
Height = 375
Left = 1800
TabIndex = 6
Top = 600
Width = 2895
_ExtentX = 5106
_ExtentY = 661
_Version = 393216
CustomFormat = "dd MMMM yyyy"
Format = 16449539
CurrentDate = 40940
End
Begin MSComCtl2.DTPicker dtpReceivedDate
Height = 375
Left = 1800
TabIndex = 7
Top = 1080
Width = 2895
_ExtentX = 5106
_ExtentY = 661
_Version = 393216
CustomFormat = "dd MMMM yyyy"
Format = 16449539
CurrentDate = 40940
End
Begin MSDataListLib.DataCombo cmbPriority
Height = 360
Left = 1800
TabIndex = 8
Top = 4560
Width = 4695
_ExtentX = 8281
_ExtentY = 635
_Version = 393216
Style = 2
Text = ""
End
Begin MSDataListLib.DataCombo cmbSender
Height = 360
Left = 1800
TabIndex = 9
Top = 120
Width = 7575
_ExtentX = 13361
_ExtentY = 635
_Version = 393216
Text = ""
End
Begin VB.Label lblNewFrom
Height = 375
Left = 9480
TabIndex = 36
Top = 120
Width = 2775
End
Begin VB.Label Label7
Caption = "From"
Height = 255
Left = 120
TabIndex = 16
Top = 120
Width = 2055
End
Begin VB.Label Label9
Caption = "Letter Date"
Height = 375
Left = 120
TabIndex = 15
Top = 600
Width = 2055
End
Begin VB.Label Label10
Caption = "Received Date"
Height = 375
Left = 120
TabIndex = 14
Top = 1080
Width = 2055
End
Begin VB.Label Label11
Caption = "Number"
Height = 375
Left = 120
TabIndex = 13
Top = 1560
Width = 2055
End
Begin VB.Label Label12
Caption = "Topic"
Height = 375
Left = 120
TabIndex = 12
Top = 2040
Width = 2055
End
Begin VB.Label Label13
Caption = "Content"
Height = 375
Left = 120
TabIndex = 11
Top = 2520
Width = 2055
End
Begin VB.Label Label14
Caption = "Priority"
Height = 375
Left = 120
TabIndex = 10
Top = 4560
Width = 2055
End
End
Attribute VB_Name = "frmLetter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Auther : Dr. M. H. B. Ariyaratne
' buddhika.ari@gmail.com
' buddhika_ari@yahoo.com
' +94 71 58 12399
' GPL Licence
Option Explicit
Dim myLetter As New clsLetter
Dim mySender As New clsPerson
Dim myAssigner As New clsPerson
Private Sub cmbSender_LostFocus()
If IsNumeric(cmbSender.BoundText) = False Then
With mySender
.AddedDate = Date
.AddedTime = Time
.AddedUserID = ProgramVariable.loggedUser.UserID
.PersonName = cmbSender.text
End With
lblNewFrom.Caption = "New"
Else
mySender.PersonID = Val(cmbSender.BoundText)
lblNewFrom.Caption = ""
End If
End Sub
Private Sub cmbAssigner_LostFocus()
If IsNumeric(cmbAssigner.BoundText) = False Then
With myAssigner
.AddedDate = Date
.AddedTime = Time
.AddedUserID = ProgramVariable.loggedUser.UserID
.PersonName = cmbAssigner.text
End With
lblNewAssigner.Caption = "New"
Else
myAssigner.PersonID = Val(cmbAssigner.BoundText)
lblNewAssigner.Caption = ""
End If
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
SetColours Me
fillCombos
dtpLetterDate.Value = Date
dtpAssigned.Value = Date
dtpComplete.Value = Date
dtpCompleteBy.Value = Date
dtpReceivedDate.Value = Date
dtpReplied.Value = Date
dtpReplyBefore.Value = Date
GetCommonSettings Me
End Sub
Private Sub txtLetterID_Change()
Set myLetter = New clsLetter
myLetter.LetterID = Val(txtLetterID.text)
displaydetails
End Sub
Private Sub displaydetails()
With myLetter
mySender.PersonID = .SenderPersonID
myAssigner.PersonID = .AssignedPersonID
cmbSender.BoundText = .SenderPersonID
txtContent.text = .LetterContent
txtLetterNo.text = .LetterNumber
txtTopic.text = .LetterTopic
dtpLetterDate.Value = .LetterDate
If .NeedReply = True Then
chkReply.Value = 1
dtpReplyBefore.Value = .ReplyDueDate
Else
chkReply.Value = 0
End If
cmbPriority.BoundText = .PriorityID
dtpReceivedDate.Value = .ReceivedDate
If .Assigned = True Then
chkAssigned.Value = 1
txtAssignComments.text = .AssignedComments
dtpAssigned.Value = .AssignedDate
cmbAssigner.BoundText = .AssignedPersonID
Else
chkAssigned.Value = 0
.AssignedComments = txtAssignComments.text
cmbAssigner.text = Empty
End If
If .NeedComplete = True Then
chkCompleteBy.Value = 1
Else
chkCompleteBy.Value = 0
End If
If .Completed = True Then
chkCompleted.Value = 1
txtCompleteComments.text = .CompletedComments
Else
chkCompleted.Value = 0
txtCompleteComments.text = .CompletedComments
End If
If .Replied = True Then
chkReplied.Value = 1
dtpReplied.Value = .RepliedDate
txtReplyComments.text = .ReplyComments
Else
chkReplied.Value = 0
txtReplyComments.text = .ReplyComments
End If
End With
End Sub
Private Sub fillCombos()
Dim Assigners As New clsFillCombo
Assigners.FillSpecificField cmbAssigner, "Person", "PersonName", True
Dim Sender As New clsFillCombo
Sender.FillSpecificField cmbSender, "Person", "PersonName", True
Dim Priority As New clsFillCombo
Priority.FillSpecificFieldOrder cmbPriority, "Priority", "PriorityName", "OrderNo", True
End Sub
Private Sub btnSave_Click()
With myLetter
If myLetter.LetterID = 0 Then
If Trim(mySender.PersonName) <> "" Then mySender.saveData
If Trim(myAssigner.PersonName) <> "" Then myAssigner.saveData
.AddedDate = Date
.AddedTime = Time
.AddedUserID = ProgramVariable.loggedUser.UserID
End If
.SenderPersonID = mySender.PersonID
.LetterContent = txtContent.text
.LetterNumber = txtLetterNo.text
.LetterTopic = txtTopic.text
.LetterDate = dtpLetterDate.Value
If chkReply.Value = 1 Then
.NeedReply = True
.ReplyDueDate = dtpReplyBefore.Value
Else
.NeedReply = False
.ReplyDueDate = Empty
End If
.PriorityID = Val(cmbPriority.BoundText)
.ReceivedDate = dtpReceivedDate.Value
If chkAssigned.Value = 1 Then
.Assigned = True
.AssignedComments = txtAssignComments.text
.AssignedDate = dtpAssigned.Value
.AssignedPersonID = myAssigner.PersonID
Else
.Assigned = False
.AssignedComments = txtAssignComments.text
.AssignedDate = Empty
.AssignedPersonID = Empty
End If
If chkCompleteBy.Value = 1 Then
.CompleteDueDate = dtpCompleteBy.Value
.NeedComplete = True
Else
.CompleteDueDate = Empty
.NeedComplete = False
End If
If chkCompleted.Value = 1 Then
.Completed = True
.CompletedComments = txtCompleteComments.text
.CompletedDate = dtpComplete.Value
Else
.Completed = False
.CompletedComments = txtCompleteComments.text
.CompletedDate = Empty
End If
If chkReplied.Value = 1 Then
.Replied = True
.RepliedDate = dtpReplied.Value
.ReplyComments = txtReplyComments.text
Else
.Replied = False
.RepliedDate = Empty
.ReplyComments = txtReplyComments.text
End If
.saveData
End With
MsgBox "Saved"
Unload Me
End Sub