-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTaxLine.cls
717 lines (352 loc) · 11.9 KB
/
TaxLine.cls
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
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "TaxLine"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Private cId As Long
Private sBusinessIdentificationNumber As String
Private sRevenueAccount As String
Private bDiscounted As Boolean
Private sExemptionCode As String
Private cAmount As Currency
Private tacAddresses As TransactionAddressCollection
Private aDetails() As TaxLineDetail
Private bTaxIncluded As Boolean
Private sTaxOverrideReason As String
Private cTaxOverrideAmount As Currency
Private sTaxOverrideType As String
Private sTaxEngine As String
Private dTaxDate As Date
Private cTaxCodeId As Long
Private sTaxCode As String
Private cTaxCalculated As Currency
Private cTaxableAmount As Currency
Private cTax As Currency
Private sSourcing As String
Private sRevAccount As String
Private dReportingDate As Date
Private sRef2 As String
Private sRef1 As String
Private cQuantity As Currency
Private cOriginAddressId As Long
Private cLineAmount As Currency
Private sItemCode As String
Private bIsSSTP As Boolean
Private bIsItemTaxable As Boolean
Private sExemptNo As String
Private cExemptCertId As Long
Private cExemptAmount As Currency
Private cDiscountTypeId As Long
Private cDiscountAmount As Currency
Private cDestinationAddressId As Long
Private sDescription As String
Private sCustomerUsageType As String
Private cBoundaryOverrideId As Long
Private sMethod As String
Private sLineNumber As String
Private cTransactionId As Long
Property Get Id() As Long
Let Id = cId
End Property
Property Let Id(Id As Long)
Let cId = Id
End Property
Property Get TransactionId() As Long
Let TransactionId = cTransactionId
End Property
Property Let TransactionId(TransactionId As Long)
Let cTransactionId = TransactionId
End Property
Property Get LineNumber() As String
Let LineNumber = sLineNumber
End Property
Property Let LineNumber(LineNumber As String)
Let sLineNumber = LineNumber
End Property
Property Get Method() As String
Let Method = sMethod
End Property
Property Let Method(Method As String)
Let sMethod = Method
End Property
Property Get BoundaryOverrideId() As Long
Let BoundaryOverrideId = cBoundaryOverrideId
End Property
Property Let BoundaryOverrideId(BoundaryOverrideId As Long)
Let cBoundaryOverrideId = BoundaryOverrideId
End Property
Property Get CustomerUsageType() As String
Let CustomerUsageType = sCustomerUsageType
End Property
Property Let CustomerUsageType(CustomerUsageType As String)
Let sCustomerUsageType = CustomerUsageType
End Property
Property Get Description() As String
Let Description = sDescription
End Property
Property Let Description(Description As String)
Let sDescription = Description
End Property
Property Get DestinationAddressId() As Long
Let DestinationAddressId = cDestinationAddressId
End Property
Property Let DestinationAddressId(DestinationAddressId As Long)
Let cDestinationAddressId = DestinationAddressId
End Property
Property Get DiscountAmount() As Currency
Let DiscountAmount = cDiscountAmount
End Property
Property Let DiscountAmount(DiscountAmount As Currency)
Let cDiscountAmount = DiscountAmount
End Property
Property Get DiscountTypeId() As Long
Let DiscountTypeId = cDiscountTypeId
End Property
Property Let DiscountTypeId(DiscountTypeId As Long)
Let cDiscountTypeId = DiscountTypeId
End Property
Property Get ExemptAmount() As Currency
Let ExemptAmount = cExemptAmount
End Property
Property Let ExemptAmount(ExemptAmount As Currency)
Let cExemptAmount = ExemptAmount
End Property
Property Get ExemptCertId() As Long
Let ExemptCertId = cExemptCertId
End Property
Property Let ExemptCertId(ExemptCertId As Long)
Let cExemptCertId = ExemptCertId
End Property
Property Get ExemptNo() As String
Let ExemptNo = sExemptNo
End Property
Property Let ExemptNo(ExemptNo As String)
Let sExemptNo = ExemptNo
End Property
Property Get IsItemTaxable() As Boolean
Let IsItemTaxable = bIsItemTaxable
End Property
Property Let IsItemTaxable(IsItemTaxable As Boolean)
Let bIsItemTaxable = IsItemTaxable
End Property
Property Get IsSSTP() As Boolean
Let IsSSTP = bIsSSTP
End Property
Property Let IsSSTP(IsSSTP As Boolean)
Let bIsSSTP = IsSSTP
End Property
Property Get ItemCode() As String
Let ItemCode = sItemCode
End Property
Property Let ItemCode(ItemCode As String)
Let sItemCode = ItemCode
End Property
Property Get LineAmount() As Currency
Let LineAmount = cLineAmount
End Property
Property Let LineAmount(LineAmount As Currency)
Let cLineAmount = LineAmount
End Property
Property Get OriginAddressId() As Long
Let OriginAddressId = cOriginAddressId
End Property
Property Let OriginAddressId(OriginAddressId As Long)
Let cOriginAddressId = OriginAddressId
End Property
Property Get Quantity() As Currency
Let Quantity = cQuantity
End Property
Property Let Quantity(Quantity As Currency)
Let cQuantity = Quantity
End Property
Property Get Ref1() As String
Let Ref1 = sRef1
End Property
Property Let Ref1(Ref1 As String)
Let sRef1 = Ref1
End Property
Property Get Ref2() As String
Let Ref2 = sRef2
End Property
Property Let Ref2(Ref2 As String)
Let sRef2 = Ref2
End Property
Property Get ReportingDate() As Date
Let ReportingDate = dReportingDate
End Property
Property Let ReportingDate(ReportingDate As Date)
Let dReportingDate = ReportingDate
End Property
Property Get RevAccount() As String
Let RevAccount = sRevAccount
End Property
Property Let RevAccount(RevAccount As String)
Let sRevAccount = RevAccount
End Property
Property Get Sourcing() As String
Let Sourcing = sSourcing
End Property
Property Let Sourcing(Sourcing As String)
Let sSourcing = Sourcing
End Property
Property Get Tax() As Currency
Let Tax = cTax
End Property
Property Let Tax(Tax As Currency)
Let cTax = Tax
End Property
Property Get TaxableAmount() As Currency
Let TaxableAmount = cTaxableAmount
End Property
Property Let TaxableAmount(TaxableAmount As Currency)
Let cTaxableAmount = TaxableAmount
End Property
Property Get TaxCalculated() As Currency
Let TaxCalculated = cTaxCalculated
End Property
Property Let TaxCalculated(TaxCalculated As Currency)
Let cTaxCalculated = TaxCalculated
End Property
Property Get TaxCode() As String
Let TaxCode = sTaxCode
End Property
Property Let TaxCode(TaxCode As String)
Let sTaxCode = TaxCode
End Property
Property Get TaxCodeId() As Long
Let TaxCodeId = cTaxCodeId
End Property
Property Let TaxCodeId(TaxCodeId As Long)
Let cTaxCodeId = TaxCodeId
End Property
Property Get TaxDate() As Date
Let TaxDate = dTaxDate
End Property
Property Let TaxDate(TaxDate As Date)
Let dTaxDate = TaxDate
End Property
Property Get TaxEngine() As String
Let TaxEngine = sTaxEngine
End Property
Property Let TaxEngine(TaxEngine As String)
Let sTaxEngine = TaxEngine
End Property
Property Get TaxOverrideType() As String
Let TaxOverrideType = sTaxOverrideType
End Property
Property Let TaxOverrideType(TaxOverrideType As String)
Let sTaxOverrideType = TaxOverrideType
End Property
Property Get TaxOverrideAmount() As Currency
Let TaxOverrideAmount = cTaxOverrideAmount
End Property
Property Let TaxOverrideAmount(TaxOverrideAmount As Currency)
Let cTaxOverrideAmount = TaxOverrideAmount
End Property
Property Get TaxOverrideReason() As String
Let TaxOverrideReason = sTaxOverrideReason
End Property
Property Let TaxOverrideReason(TaxOverrideReason As String)
Let sTaxOverrideReason = TaxOverrideReason
End Property
Property Get TaxIncluded() As Boolean
Let TaxIncluded = bTaxIncluded
End Property
Property Let TaxIncluded(TaxIncluded As Boolean)
Let bTaxIncluded = TaxIncluded
End Property
Property Get Details(index As Long) As TaxLineDetail
Set Details = aDetails(index)
End Property
Property Set Details(index As Long, detail As TaxLineDetail)
Set aDetails(index) = detail
End Property
Property Get addresses() As TransactionAddressCollection
Set addresses = tacAddresses
End Property
Property Set addresses(addresses As TransactionAddressCollection)
Set tacAddresses = addresses
End Property
Property Get Amount() As Currency
Let Amount = cAmount
End Property
Property Let Amount(Amount As Currency)
Let cAmount = Amount
End Property
Property Get ExemptionCode() As String
Let ExemptionCode = sExemptionCode
End Property
Property Let ExemptionCode(ExemptionCode As String)
Let sExemptionCode = ExemptionCode
End Property
Property Get Discounted() As Boolean
Let Discounted = bDiscounted
End Property
Property Let Discounted(Discounted As Boolean)
Let bDiscounted = Discounted
End Property
Property Get RevenueAccount() As String
Let RevenueAccount = sRevenueAccount
End Property
Property Let RevenueAccount(RevenueAccount As String)
Let sRevenueAccount = RevenueAccount
End Property
Property Get BusinessIdentificationNumber() As String
Let BusinessIdentificationNumber = sBusinessIdentificationNumber
End Property
Property Let BusinessIdentificationNumber(BusinessIdentificationNumber As String)
Let sBusinessIdentificationNumber = BusinessIdentificationNumber
End Property
Function ToJson() As Object
Dim Json As Object
Set Json = JsonConverter.ParseJson("{}")
If Me.LineNumber = "" Then
Err.Raise vbObjectError + 1000, Description:="A line number must be provided."
End If
Json("number") = Me.LineNumber
Json("quantity") = Me.Quantity
Json("amount") = Me.Amount
If Not Me.addresses Is Nothing Then
Set Json("addresses") = Me.addresses.ToJson()
End If
If Me.TaxCode <> "" Then
Json("taxCode") = Me.TaxCode
End If
If Me.CustomerUsageType <> "" Then
Json("customerUsageType") = Me.CustomerUsageType
End If
If Me.ItemCode <> "" Then
Json("itemCode") = Me.ItemCode
End If
If Me.ExemptionCode <> "" Then
Json("exemptionCode") = Me.ExemptionCode
End If
Json("discounted") = Me.Discounted
Json("taxIncluded") = Me.TaxIncluded
If Me.RevenueAccount <> "" Then
Json("revenueAccount") = Me.RevenueAccount
End If
If Me.Ref1 <> "" Then
Json("ref1") = Me.Ref1
End If
If Me.Ref2 <> "" Then
Json("ref2") = Me.Ref2
End If
If Me.Description <> "" Then
Json("description") = Me.Description
End If
If Me.BusinessIdentificationNumber <> "" Then
Json("businessIdentificationNo") = Me.BusinessIdentificationNumber
End If
If Me.TaxOverrideAmount <> 0 Then
Json("taxOverride")("taxAmount") = Me.TaxOverrideAmount
Json("taxOverride")("type") = Me.TaxOverrideType
Json("taxOverride")("reason") = Me.TaxOverrideReason
Json("taxOverride")("taxDate") = Me.TaxDate
End If
Set ToJson = Json
End Function