-
Notifications
You must be signed in to change notification settings - Fork 0
/
snowloadcountmain.go
639 lines (550 loc) · 20.1 KB
/
snowloadcountmain.go
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
//snowloadcountmain.go
package main
import (
"fmt"
"gopkg.in/qml.v0"
"os"
"time"
"bufio"
"io/ioutil"
"log"
"encoding/json"
"strconv"
"bytes"
//"strings"
)
const SHIFTSTARTTIME = string("shiftstarttime")
const SHIFTENDTIME = string("shiftendtime")
const SHIFTSTARTDATE = string("shiftstartdate")
const GUARDNAME = string("guardname")
const LICENSENUMBER = string("licensenumber")
const SHIFTCOMMENT = string("shiftcomment")
const COUNTLOCATION = string("countlocation")
const COUNTFORITEMTYPE = string("countforitemtype")
const SINGLEAXLE = string("singleaxle")
const TANDEMAXLE = string("tandem2axle")
const TRIPLEAXLE = string("tripleaxle")
const COMBOTRUCK = string("combotruck")
const SEMITRAILER = string("semitrailer")
//json stuff has to have fields with names starting with uppercase letters
//this is a golang special wierdness
//to be honest, I'm not happy about this
//We should have complete control over our variable names
type SNLDB struct {
SNLMap map[string]string `json:"SNLMap"`
SingleL []time.Time `json:"SingleL"`
TandemL []time.Time `json:"TandemL"`
TripleL []time.Time `json:"TripleL"`
ComboL []time.Time `json:"ComboL"`
SemiL []time.Time `json:"SemiL"`
}
func NewSNLDB() *SNLDB {
f := SNLDB{}
f.SNLMap = make(map[string]string)
f.SingleL = make([]time.Time, 0, 200) //average maximum number trucks counted in one night
f.TandemL = make([]time.Time, 0, 200)
f.TripleL = make([]time.Time, 0, 200)
f.ComboL = make([]time.Time, 0, 200)
f.SemiL = make([]time.Time, 0, 200)
return &f
}
func (s *SNLDB) testSetAndGetDataFields() {
s.setShiftStartTime("b");
s.setShiftEndTime("c");
s.setShiftStartDate("d");
s.setGuardName("e");
s.setLicenseNumber("f");
s.setShiftComment("g");
s.setCountLocation("h");
s.setCountForItemType("i");
s.singleAxleArrived();
s.tandemAxleArrived();
s.tandemAxleArrived();
s.tripleAxleArrived();
s.tripleAxleArrived();
s.tripleAxleArrived();
s.comboTruckArrived();
s.comboTruckArrived();
s.comboTruckArrived();
s.comboTruckArrived();
s.semiTrailerArrived();
s.semiTrailerArrived();
s.semiTrailerArrived();
s.semiTrailerArrived();
s.semiTrailerArrived();
fmt.Printf("%v\n", s.getShiftStartTime())
fmt.Printf("%v\n", s.getShiftEndTime())
fmt.Printf("%v\n", s.getShiftStartDate())
fmt.Printf("%v\n", s.getGuardName())
fmt.Printf("%v\n", s.getLicenseNumber())
fmt.Printf("%v\n", s.getShiftComment())
fmt.Printf("%v\n", s.getCountLocation())
fmt.Printf("%v\n", s.getCountForItemType())
fmt.Printf("single total: %v\n", s.getSingleAxleTotal())
fmt.Printf("tandem total: %v\n", s.getTandemAxleTotal())
fmt.Printf("triple total: %v\n", s.getTripleAxleTotal())
fmt.Printf("combo total: %v\n" , s.getComboTruckTotal())
fmt.Printf("semi total: %v\n", s.getSemiTrailerTotal())
}
func (s *SNLDB) debugDataFields() {
fmt.Printf("%v\n", s.getShiftStartTime())
fmt.Printf("%v\n", s.getShiftEndTime())
fmt.Printf("%v\n", s.getShiftStartDate())
fmt.Printf("%v\n", s.getGuardName())
fmt.Printf("%v\n", s.getLicenseNumber())
fmt.Printf("%v\n", s.getShiftComment())
fmt.Printf("%v\n", s.getCountLocation())
fmt.Printf("%v\n", s.getCountForItemType())
fmt.Printf("single total: %v\n", s.getSingleAxleTotal())
fmt.Printf("tandem total: %v\n", s.getTandemAxleTotal())
fmt.Printf("triple total: %v\n", s.getTripleAxleTotal())
fmt.Printf("combo total: %v\n" , s.getComboTruckTotal())
fmt.Printf("semi total: %v\n", s.getSemiTrailerTotal())
}
func (s *SNLDB) getShiftStartTime() string {
return string(s.SNLMap[SHIFTSTARTTIME])
}
func (s *SNLDB) getShiftEndTime() string {
return string(s.SNLMap[SHIFTENDTIME])
}
func (s *SNLDB) getShiftStartDate() string {
return string(s.SNLMap[SHIFTSTARTDATE])
}
func (s *SNLDB) getGuardName() string {
return string(s.SNLMap[GUARDNAME])
}
func (s *SNLDB) getLicenseNumber() string {
return string(s.SNLMap[LICENSENUMBER])
}
func (s *SNLDB) getShiftComment() string {
return string(s.SNLMap[SHIFTCOMMENT])
}
func (s *SNLDB) getCountLocation() string {
return string(s.SNLMap[COUNTLOCATION])
}
func (s *SNLDB) getCountForItemType() string {
return string(s.SNLMap[COUNTFORITEMTYPE])
}
func (s *SNLDB) setShiftStartTime(s_ string) {
s.SNLMap[SHIFTSTARTTIME] = s_
}
func (s *SNLDB) setShiftEndTime(s_ string) {
s.SNLMap[SHIFTENDTIME] = s_
}
func (s *SNLDB) setShiftStartDate(s_ string) {
s.SNLMap[SHIFTSTARTDATE] = s_
}
func (s *SNLDB) setGuardName(s_ string) {
s.SNLMap[GUARDNAME] = s_
}
func (s *SNLDB) setLicenseNumber(s_ string) {
s.SNLMap[LICENSENUMBER] = s_
}
func (s *SNLDB) setShiftComment(s_ string) {
s.SNLMap[SHIFTCOMMENT] = s_
}
func (s *SNLDB) setCountLocation(s_ string) {
s.SNLMap[COUNTLOCATION] = s_
}
func (s *SNLDB) setCountForItemType(s_ string) {
s.SNLMap[COUNTFORITEMTYPE] = s_
}
func (s *SNLDB) getSingleAxleTotal() int {
return len(s.SingleL)
}
func (s *SNLDB) getTandemAxleTotal() int {
return len(s.TandemL)
}
func (s *SNLDB) getTripleAxleTotal() int {
return len(s.TripleL)
}
func (s *SNLDB) getComboTruckTotal() int {
return len(s.ComboL)
}
func (s *SNLDB) getSemiTrailerTotal() int {
return len(s.SemiL)
}
func (s *SNLDB) singleAxleArrived() {
s.SingleL = append(s.SingleL, time.Now())
}
func (s *SNLDB) tandemAxleArrived() {
s.TandemL = append(s.TandemL, time.Now())
}
func (s *SNLDB) tripleAxleArrived() {
s.TripleL = append(s.TripleL, time.Now())
}
func (s *SNLDB) comboTruckArrived() {
s.ComboL = append(s.ComboL, time.Now())
}
func (s *SNLDB) semiTrailerArrived() {
s.SemiL = append(s.SemiL, time.Now())
}
func (s *SNLDB) clear() {
s.SNLMap = make(map[string]string)
s.SingleL = make([]time.Time, 0, 200) //average maximum number trucks counted in one night
s.TandemL = make([]time.Time, 0, 200)
s.TripleL = make([]time.Time, 0, 200)
s.ComboL = make([]time.Time, 0, 200)
s.SemiL = make([]time.Time, 0, 200)
}
func (ctrl *Control) saveJsonFileSNLDB(myFileName string, f *SNLDB) () {
fo, err := os.Create(myFileName)
if err != nil { panic(err) }
defer fo.Close()
w := bufio.NewWriter(fo)
var myjsonBytes bytes.Buffer
enc := json.NewEncoder(&myjsonBytes)
err = enc.Encode(f)
//fmt.Println("myjsonbytes %v\n", myjsonBytes)
if err != nil {
log.Fatal(err)
}
_, err = w.Write(myjsonBytes.Bytes())
if err != nil {
log.Fatal(err)
}
if err = w.Flush(); err != nil {
log.Fatal(err)
}
}
func (ctrl *Control) readJsonFileSNLDB(myFileName string) (*SNLDB) {
file, err2 := ioutil.ReadFile(myFileName)
if err2 != nil {
log.Fatal(err2)
}
jsonBytes := bytes.NewBuffer(file)
dec := json.NewDecoder(jsonBytes)
var res SNLDB
err3 := dec.Decode(&res)
if err3 != nil {
log.Fatal(err3)
}
//fmt.Printf("Read Results: %+v %v\n", res, err3)
return &res
}
func main() {
if err := run(); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
}
}
func run() error {
qml.Init(nil)
engine := qml.NewEngine()
engine.On("quit", func() { os.Exit(0) })
component2, err := engine.LoadFile("snowloadcount.qml")
if err != nil {
return err
}
window := component2.CreateWindow(nil)
ctrl := Control{
Messagetf1:"tf1inithey",
Messagebt1:"bt1inithey",
// StartTimeMessage: time.Now().String(),
// EndTimeMessage: time.Now().String(),
// StartDateMessage: time.Now().String(),
StartTimeMessage: "",
EndTimeMessage: "",
//StartDateMessage: "",
SingleAxleMessage:"0",
TandemAxleMessage:"0",
TripleAxleMessage:"0",
ComboAxleMessage:"0",
SemiAxleMessage:"0",
IsLoadedReport:false,
LoadedReportFilename:"",
Snldb:NewSNLDB()}
context := engine.Context()
context.SetVar("ctrl", &ctrl)
ctrl.Root = window.Root()
window.Show()
window.Wait()
return nil
}
type Control struct {
Root qml.Object
Messagebt1 string
Messagetf1 string
StartTimeMessage string
EndTimeMessage string
//StartDateMessage string
SingleAxleMessage string
TandemAxleMessage string
TripleAxleMessage string
ComboAxleMessage string
SemiAxleMessage string
//all the stuff in gotype could be here
//to facilitate the setting/getting
IsLoadedReport bool
LoadedReportFilename string
Snldb *SNLDB
}
//save one field from the gui wizard
func (ctrl *Control) Savetf1contents(text qml.Object) {
fmt.Println("in Savetf1contents():")
fmt.Println("text:", text.String("text"))
}
//save another field from the gui wizard
func (ctrl *Control) Savebt1contents(text qml.Object) {
fmt.Println("in Savebt1contents():")
fmt.Println("text:", text.String("text"))
}
func (ctrl *Control) Loadtf1contents(text qml.Object) {
fmt.Println("in Loadtf1contents():")
fmt.Println("text:", text.String("text"))
go func() {
ctrl.Messagetf1 = "loaded from tf1..."
qml.Changed(ctrl, &ctrl.Messagetf1)
}()
}
func (ctrl *Control) Loadbt1contents(text qml.Object) {
fmt.Println("in Loadbt1contents():")
fmt.Println("text:", text.String("text"))
go func() {
ctrl.Messagebt1 = "loaded from bt1"
qml.Changed(ctrl, &ctrl.Messagebt1)
}()
}
func (ctrl *Control) OpenReportNextButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in OpenReportNextButtonClickedGo():")
}
func (ctrl *Control) OpenReportCloseAppButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in OpenReportCloseAppButtonClickedGo:")
}
func (ctrl *Control) OpenReportOpenReportButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in OpenReportOpenReportButtonClickedGo:")
//openReport_FileNameEntry
filename_ := theQmlObject.String("text")
//filename_ = "snowloadcount20140425T094420.905286751.json"
fmt.Println("filenameentry:", filename_ )
ctrl.Snldb = ctrl.readJsonFileSNLDB(filename_)
ctrl.Snldb.debugDataFields()
ctrl.IsLoadedReport = true
ctrl.LoadedReportFilename = filename_
go func() {
ctrl.loadReportDataIntoGui()
}()
}
func (ctrl *Control) GuardShiftStartTimePreviousButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in GuardShiftStartTimePreviousButtonClickedGo:")
}
func (ctrl *Control) GuardShiftStartTimeNextButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in GuardShiftStartTimeNextButtonClickedGo:")
//guardShiftStartTime_label
starttime_ := theQmlObject.String("text")
ctrl.Snldb.setShiftStartTime(starttime_);
}
func (ctrl *Control) GuardShiftEndTimePreviousButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in GuardShiftEndTimePreviousButtonClickedGo:")
}
func (ctrl *Control) GuardShiftEndTimeNextButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in GuardShiftEndTimeNextButtonClickedGo:")
//guardShiftEndTime_label
endtime_ := theQmlObject.String("text")
ctrl.Snldb.setShiftEndTime(endtime_);
}
func (ctrl *Control) GuardShiftStartDatePreviousButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in GuardShiftStartDatePreviousButtonClickedGo:")
}
func (ctrl *Control) GuardShiftStartDateNextButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in GuardShiftStartDateNextButtonClickedGo:")
//guardShiftStartDate_ShiftDateLabel
startDate_ := theQmlObject.String("text")
ctrl.Snldb.setShiftStartDate(startDate_);
}
func (ctrl *Control) GuardShiftInfoPreviousButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in GuardShiftInfoPreviousButtonClickedGo:")
}
func (ctrl *Control) GuardShiftInfoSNLDBSetGuardNameGo(theQmlObject qml.Object) {
fmt.Println("in GuardShiftInfoNextButtonClickedGo:")
//guardShiftInfo_GuardNameEntry
guardName_ := theQmlObject.String("text")
ctrl.Snldb.setGuardName(guardName_);
}
func (ctrl *Control) GuardShiftInfoSNLDBSetLicenseNumberGo(theQmlObject qml.Object) {
fmt.Println("in GuardShiftInfoNextButtonClickedGo:")
//guardShiftInfo_GuardLicenseNumberEntry
licenseNumber_ := theQmlObject.String("text")
ctrl.Snldb.setLicenseNumber(licenseNumber_);
}
func (ctrl *Control) GuardShiftInfoSNLDBSetShiftCommentGo(theQmlObject qml.Object) {
fmt.Println("in GuardShiftInfoNextButtonClickedGo:")
//guardShiftInfo_ShiftCommentsEntry
shiftComment_ := theQmlObject.String("text")
ctrl.Snldb.setShiftComment(shiftComment_);
}
func (ctrl *Control) GuardLocationPreviousButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in GuardLocationPreviousButtonClickedGo:")
}
func (ctrl *Control) GuardLocationNextButtonClickedGo(theString string) {
fmt.Println("in GuardLocationNextButtonClickedGo:")
ctrl.Snldb.setCountLocation(theString);
}
func (ctrl *Control) AdmissionTypePreviousButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in AdmissionTypePreviousButtonClickedGo:")
}
func (ctrl *Control) AdmissionTypeNextButtonClickedGo(theString string) {
fmt.Println("in AdmissionTypeNextButtonClickedGo:")
ctrl.Snldb.setCountForItemType(theString);
}
func (ctrl *Control) TruckTypeSingleAxleClickedGo(TruckType_SingleAxleLabel qml.Object) {
fmt.Println("in TruckTypeSingleAxleClickedGo:")
ctrl.Snldb.singleAxleArrived();
go func() {
ctrl.SingleAxleMessage = strconv.Itoa( ctrl.Snldb.getSingleAxleTotal() )
qml.Changed(ctrl, &ctrl.SingleAxleMessage)
}()
}
func (ctrl *Control) TruckTypeTandemAxleClickedGo(TruckType_TandemAxleLabel qml.Object) {
fmt.Println("in TruckTypeTandemAxleClickedGo:")
ctrl.Snldb.tandemAxleArrived();
go func() {
ctrl.TandemAxleMessage = strconv.Itoa( ctrl.Snldb.getTandemAxleTotal() )
qml.Changed(ctrl, &ctrl.TandemAxleMessage)
}()
}
func (ctrl *Control) TruckTypeTripleAxleClickedGo(TruckType_TripleAxleLabel qml.Object) {
fmt.Println("in TruckTypeTripleAxleClickedGo:")
ctrl.Snldb.tripleAxleArrived();
go func() {
ctrl.TripleAxleMessage = strconv.Itoa( ctrl.Snldb.getTripleAxleTotal() )
qml.Changed(ctrl, &ctrl.TripleAxleMessage)
}()
}
func (ctrl *Control) TruckTypeComboAxleClickedGo(TruckType_ComboAxleLabel qml.Object) {
fmt.Println("in TruckTypeComboAxleClickedGo:")
ctrl.Snldb.comboTruckArrived();
go func() {
ctrl.ComboAxleMessage = strconv.Itoa( ctrl.Snldb.getComboTruckTotal() )
qml.Changed(ctrl, &ctrl.ComboAxleMessage)
}()
}
func (ctrl *Control) TruckTypeSemiAxleClickedGo(TruckType_SemiAxleLabel qml.Object) {
fmt.Println("in TruckTypeSemiAxleClickedGo:")
ctrl.Snldb.semiTrailerArrived();
go func() {
ctrl.SemiAxleMessage = strconv.Itoa( ctrl.Snldb.getSemiTrailerTotal() )
qml.Changed(ctrl, &ctrl.SemiAxleMessage)
}()
}
func (ctrl *Control) TruckTypePreviousButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in TruckTypePreviousButtonClickedGo:")
}
func (ctrl *Control) TruckTypeFinishButtonClickedGo(theQmlObject qml.Object) {
fmt.Println("in TruckTypeFinishButtonClickedGo:")
ctrl.saveJsonFileSNLDB(ctrl.generateUniqueReportFilename(), ctrl.Snldb)
}
func (ctrl *Control) loadReportDataIntoGui() {
//taken from the go-qml particle example
//important qml object navigation stuff
//1)get the qml object class factory with id "emitterComponent"
//component := ctrl.Root.Object("emitterComponent")
//2)create an object instance of it
//emitter := component.Create(nil)
//3)set the property "x" with that object
//emitter.Set("x", x)
//4)get the objectinstance "xAnim", then call its function named "start"
//emitter.ObjectByName("xAnim").Call("start")
go func() {
//myStartTimeParts := strings.Split(ctrl.Snldb.getShiftStartTime(), ":")
//fmt.Println("snldbstarttime:", ctrl.Snldb.getShiftStartTime() )
//myHourPart, _ := strconv.Atoi(myStartTimeParts[0])
//myMinutePart, _ := strconv.Atoi(myStartTimeParts[1])
//mySecondPart, _ := strconv.Atoi(myStartTimeParts[2])
//hours/minutes/seconds property is read-only. We must reset the entire date.
//ctrl.Root.ObjectByName("guardShiftStartTime_ShiftStartTimePicker").Set("hours", myHourPart )
//ctrl.Root.ObjectByName("guardShiftStartTime_ShiftStartTimePicker").Set("minutes", myMinutePart )
//ctrl.Root.ObjectByName("guardShiftStartTime_ShiftStartTimePicker").Set("seconds", mySecondPart )
//ctrl.Root.ObjectByName("guardShiftStartTime_ShiftStartTimePicker").Set("date", time.Now().String() )
fmt.Println("set date: time.Now().String() works:", time.Now().String() )
ctrl.StartTimeMessage = time.Now().String()
qml.Changed(ctrl, &ctrl.StartTimeMessage)
}()
go func() {
// myEndTimeParts := strings.Split(ctrl.Snldb.getShiftEndTime(), ":")
// myHourPart, _ := strconv.Atoi(myEndTimeParts[0])
// myMinutePart, _ := strconv.Atoi(myEndTimeParts[1])
// mySecondPart, _ := strconv.Atoi(myEndTimeParts[2])
// ctrl.Root.ObjectByName("guardShiftEndTime_ShiftEndTimePicker").Set("hour", myHourPart)
// ctrl.Root.ObjectByName("guardShiftEndTime_ShiftEndTimePicker").Set("minute", myMinutePart)
// ctrl.Root.ObjectByName("guardShiftEndTime_ShiftEndTimePicker").Set("second", mySecondPart)
ctrl.EndTimeMessage = time.Now().String()
qml.Changed(ctrl, &ctrl.EndTimeMessage)
}()
// go func() {
// myDateParts := strings.Split(ctrl.Snldb.getShiftStartDate(), "-")
// myYearPart, _ := strconv.Atoi(myDateParts[2])
// myMonthPart, _ := strconv.Atoi(myDateParts[1])
// myDayPart, _ := strconv.Atoi(myDateParts[0])
// ctrl.Root.ObjectByName("guardShiftStartDate_ShiftStartDatePicker").Set("year", myYearPart)
// ctrl.Root.ObjectByName("guardShiftStartDate_ShiftStartDatePicker").Set("month", myMonthPart)
// ctrl.Root.ObjectByName("guardShiftStartDate_ShiftStartDatePicker").Set("day", myDayPart)
//ctrl.StartDateMessage = time.Now().String()
//qml.Changed(ctrl, &ctrl.StartDateMessage)
//}()
go func() {
ctrl.Root.ObjectByName("guardShiftInfo_GuardNameEntry").Set("text", ctrl.Snldb.getGuardName())
}()
go func() {
ctrl.Root.ObjectByName("guardShiftInfo_GuardLicenseNumberEntry").Set("text", ctrl.Snldb.getLicenseNumber())
}()
go func() {
ctrl.Root.ObjectByName("guardShiftInfo_ShiftCommentsEntry").Set("text", ctrl.Snldb.getShiftComment())
}()
// //sa.setActiveCountLocation(ctrl.Snldb.getCountLocation())
// //ctrl.Root.ObjectByName("")
// //countingAtLocationSelector
// //countingAtLocationSelector.model[countingAtLocationSelector.selectedIndex]
// //sa.setActiveCountForItemType(ctrl.Snldb.getCountForItemType())
// //ctrl.Root.ObjectByName("")
// //countingTotalsForOptionSelector
// //countingTotalsForOptionSelector.model[countingTotalsForOptionSelector.selectedIndex]
go func() {
ctrl.SingleAxleMessage = strconv.Itoa( ctrl.Snldb.getSingleAxleTotal() )
qml.Changed(ctrl, &ctrl.SingleAxleMessage)
}()
go func() {
ctrl.TandemAxleMessage = strconv.Itoa( ctrl.Snldb.getTandemAxleTotal() )
qml.Changed(ctrl, &ctrl.TandemAxleMessage)
}()
go func() {
ctrl.TripleAxleMessage = strconv.Itoa( ctrl.Snldb.getTripleAxleTotal() )
qml.Changed(ctrl, &ctrl.TripleAxleMessage)
}()
go func() {
ctrl.ComboAxleMessage = strconv.Itoa( ctrl.Snldb.getComboTruckTotal() )
qml.Changed(ctrl, &ctrl.ComboAxleMessage)
}()
go func() {
ctrl.SemiAxleMessage = strconv.Itoa( ctrl.Snldb.getSemiTrailerTotal() )
qml.Changed(ctrl, &ctrl.SemiAxleMessage)
}()
//disable all the fields after filling them/changing them while in loaded report mode.
//sa.shiftStartTimeEntry.SetSensitive(false)
//sa.shiftEndTimeEntry.SetSensitive(false)
//sa.shiftStartDateEntry.SetSensitive(false)
//sa.guardNameEntry.SetSensitive(false)
//sa.guardLicenceNumberEntry.SetSensitive(false)
//sa.guardShiftCommentsEntry.SetSensitive(false)
//sa.conroyRadio.SetSensitive(false)
//sa.michaelRadio.SetSensitive(false)
//sa.strandherdRadio.SetSensitive(false)
//sa.innesRadio.SetSensitive(false)
//sa.clydeRadio.SetSensitive(false)
//sa.passesRadio.SetSensitive(false)
//sa.ticketsRadio.SetSensitive(false)
//sa.singleaxlebutton.SetSensitive(false)
//sa.tandemaxlebutton.SetSensitive(false)
//sa.tripleaxlebutton.SetSensitive(false)
//sa.combotruckbutton.SetSensitive(false)
//sa.semitrailerbutton.SetSensitive(false)
}
func (ctrl *Control) generateUniqueReportFilename() string {
var myUniqueFilename string
var t time.Time
var myIsoTime string
t = time.Now()
myIsoTime = fmt.Sprintf("%d%02d%02dT%02d%02d%02d.%09d", t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond())
myUniqueFilename = "snowloadcount" + myIsoTime + ".json";
return myUniqueFilename
}