-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule3.bas
More file actions
4349 lines (3668 loc) · 150 KB
/
Copy pathModule3.bas
File metadata and controls
4349 lines (3668 loc) · 150 KB
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
Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Dim i, count As Integer
Dim s As String
Dim fff As String
'Start dim
Dim msginit As String
Dim msginit21 As String
Dim FirstName_1 As Variant
Dim MiddleName_1 As Variant
Dim SurNameOrOrgName_1 As Variant
Dim PAN_1 As Variant
Dim ResidenceNo_1 As Variant
Dim ResidenceName_1 As Variant
Dim RoadOrStreet_1 As Variant
Dim LocalityOrArea_1 As Variant
Dim CityOrTownOrDistrict_1 As Variant
Dim StateCode_1 As Variant
Dim PinCode_1 As Variant
Dim STDcode_1 As Variant
Dim PhoneNo_1 As Variant
Dim MobileNo_1 As Variant
Dim EmailAddress_1 As Variant
Dim DOB_1 As Variant
Dim EmployerCategory_1 As Variant
Dim Gender_1 As Variant
Dim DesigOfficerWardorCircle_1 As Variant
Dim ReturnFileSec_1 As Variant
Dim ReturnType_1 As Variant
Dim ReceiptNo_1 As Variant
Dim OrigRetFiledDate_1 As Variant
Dim ResidentialStatus_1 As Variant
Dim AsseseeRepFlg_1 As Variant
Dim RepName_1 As Variant
Dim RepAddress_1 As Variant
Dim RepPAN_1 As Variant
Dim LiableSec44AAflg_1 As Variant
Dim LiableSec44ABflg_1 As Variant
Dim AuditorName_1 As Variant
Dim AuditorMemNo_1 As Variant
Dim AudFrmName_1 As Variant
Dim AudFrmPAN_1 As Variant
Dim AuditDate_1 As Variant
Dim msgValidateSheet1 As String
Dim msgValidateSheet1Blanks As String
Dim msgValidateSheet1specialcharacters As String
Dim msgstats As String
Dim msgstate As String
Dim status_1 As Variant
Dim verPAN As Variant
'Variable Declaration
Dim IncomeFromSal_IncD As Variant
Dim IncomeFromHP_IncD As Variant
Dim FamPension_IncD As Variant
Dim IndInterest_IncD As Variant
Dim IncomeFromOS_IncD As Variant
Dim GrossTotIncome_IncD As Variant
Dim Section80C_IncD As Variant
Dim Section80CCC_IncD As Variant
Dim Section80CCD_IncD As Variant
Dim Section80CCF_IncD As Variant
Dim Section80D_IncD As Variant
Dim Section80DD_IncD As Variant
Dim Section80DDB_IncD As Variant
Dim Section80E_IncD As Variant
Dim Section80G_IncD As Variant
Dim Section80GG_IncD As Variant
Dim Section80GGA_IncD As Variant
Dim Section80GGC_IncD As Variant
Dim Section80U_IncD As Variant
Dim TotalChapVIADeductions_IncD As Variant
Dim TotalIncome_IncD As Variant
Dim NetAgriculturalIncome_IncD As Variant
Dim AggregateIncome_IncD As Variant
Dim TaxOnAggregateInc_IncD As Variant
Dim RebateOnAgriInc_IncD As Variant
Dim TotalTaxPayable_IncD As Variant
Dim SurchargeOnTaxPayable_IncD As Variant
Dim EducationCess_IncD As Variant
Dim GrossTaxLiability_IncD As Variant
Dim Section89_IncD As Variant
Dim Section90and91_IncD As Variant
Dim NetTaxLiability_IncD As Variant
Dim IntrstPayUs234A_IncD As Variant
Dim IntrstPayUs234B_IncD As Variant
Dim IntrstPayUs234C_IncD As Variant
Dim TotalIntrstPay_IncD As Variant
Dim TotTaxPlusIntrstPay_IncD As Variant
Dim AdvanceTax_IncD As Variant
Dim TDS_IncD As Variant
Dim SelfAssessmentTax_IncD As Variant
Dim TotalTaxesPaid_IncD As Variant
Dim BalTaxPayable_IncD As Variant
Dim RefundDue_IncD As Variant
Dim BankAccountNumber_IncD As Variant
Dim EcsRequired_IncD As Variant
Dim MICRCode_IncD As Variant
Dim BankAccountType_IncD As Variant
Dim TAN_TDSal As Variant
Dim EmployerOrDeductorOrCollecterName_TDSal As Variant
Dim AddrDetail_TDSal As Variant
Dim CityOrTownOrDistrict_TDSal As Variant
Dim StateCode_TDSal As Variant
Dim PinCode_TDSal As Variant
Dim IncChrgSal_TDSal As Variant
Dim DeductUnderChapVIA_TDSal As Variant
Dim TaxPayIncluSurchEdnCes_TDSal As Variant
Dim TotalTDSSal_TDSal As Variant
Dim TaxPayRefund_TDSal As Variant
Dim TAN_TDSoth As Variant
Dim EmployerOrDeductorOrCollecterName_TDSoth As Variant
Dim AddrDetail_TDSoth As Variant
Dim CityOrTownOrDistrict_TDSoth As Variant
Dim StateCode_TDSoth As Variant
Dim PinCode_TDSoth As Variant
Dim AmtPaid_TDSoth As Variant
Dim DatePayCred_TDSoth As Variant
Dim TotTDSOnAmtPaid_TDSoth As Variant
Dim ClaimOutOfTotTDSOnAmtPaid_TDSoth As Variant
Dim NameOfBank_TaxP As Variant
Dim NameOfBranch_TaxP As Variant
Dim BSRCode_TaxP As Variant
Dim DateDep_TaxP As Variant
Dim SrlNoOfChaln_TaxP As Variant
Dim Amt_TaxP As Variant
Dim Code001_AIR As Variant
Dim Code002_AIR As Variant
Dim Code003_AIR As Variant
Dim Code004_AIR As Variant
Dim Code005_AIR As Variant
Dim Code006_AIR As Variant
Dim Code007_AIR As Variant
Dim Code008_AIR As Variant
Dim TaxExmpIntInc_AIR As Variant
Dim AssesseeVerName_Ver As Variant
Dim FatherName_Ver As Variant
Dim Place_Ver As Variant
Dim Date_Ver As Variant
Dim IdentificationNoOfTRP_Ver As Variant
Dim NameOfTRP_Ver As Variant
Dim ReImbFrmGov_Ver As Variant
'Variable and Function Declaration for TableType=T1 and RptFrm
Dim msgValidateSheetIncD As String
Dim rngname_TDSal As Variant
Dim end_TDSal As Variant
Dim incBy_TDSal As Variant
Dim msgValidateSheetTDSal As String
Dim rngname_TDSal2 As Variant
Dim end_TDSal2 As Variant
Dim rngname_TDSoth As Variant
Dim end_TDSoth As Variant
Dim incBy_TDSoth As Variant
Dim msgValidateSheetTDSoth As String
Dim rngname_TDSoth2 As Variant
Dim end_TDSoth2 As Variant
Dim rngname_TaxP As Variant
Dim end_TaxP As Variant
Dim incBy_TaxP As Variant
Dim msgValidateSheetTaxP As String
Dim rngname_TaxP2 As Variant
Dim end_TaxP2 As Variant
Dim msgValidateSheetAIR As String
Const msgstats1 As String = "BE"
Dim msgValidateSheetVer As String
Dim Total_Count As Integer
Dim secapplicable() As Variant
Dim secapplicable1() As Variant
Dim sectionname() As Variant
Function getmsgstate() As String
'msgstate = Sheet6.Range(msgstats1 + "1")
msgstate = ""
msgstate = msgstate + "(21)"
getmsgstate = msgstate
End Function
Sub AddRows_TDSal()
setTblinfo_TDSal
Dim numberofrows As Integer
SelectLastRow ("TDSal.TAN")
numberofrows = InsertRowsAndFillFormulas()
Call ExendRangeNameToTable(numberofrows, rngname_TDSal)
End Sub
Sub setTblinfo_TDSal()
Dim rangecells As Object
Dim mIntCells As Integer
Dim mIntCtr As Integer
Dim ccount As Integer
ccount = 0
Set rangecells = ThisComponent.Sheets(1).getCellRangeByName("TDSal.TAN_1")
mIntCells = rangecells.ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
For mIntCtr = 0 To mIntCells - 1
If rangecells.getCellByPosition(0, mIntCtr).Type = EMPTY Then
ccount = ccount + 1
End If
Next
end_TDSal = ccount
rngname_TDSal = "TDSal.TAN;TDSal.EmployerOrDeductorOrCollecterName;TDSal.IncChrgSal;TDSal.TotalTDSSal;"
End Sub
Sub setTblinfo_TDSal2()
Dim rangecells As Object
Dim mIntCells As Integer
Dim mIntCtr As Integer
Dim ccount As Integer
ccount = 0
Set rangecells = ThisComponent.Sheets(1).getCellRangeByName("TDSal.TotalTDSSal")
mIntCells = rangecells.ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
For mIntCtr = 0 To mIntCells - 1
If rangecells.getCellByPosition(0, mIntCtr).Type = EMPTY Then
ccount = ccount + 1
End If
Next
end_TDSal2 = ccount
rngname_TDSal2 = "TDSal.TAN;TDSal.EmployerOrDeductorOrCollecterName;TDSal.IncChrgSal;TDSal.TotalTDSSal;"
End Sub
Sub AddRows_TDSoth()
setTblinfo_TDSoth
Dim numberofrows As Integer
SelectLastRow ("TDSoth.TAN")
numberofrows = InsertRowsAndFillFormulas()
Call ExendRangeNameToTable(numberofrows, rngname_TDSoth)
End Sub
Sub setTblinfo_TDSoth()
Dim rangecells As Object
Dim mIntCells As Integer
Dim mIntCtr As Integer
Dim ccount As Integer
ccount = 0
Set rangecells = ThisComponent.Sheets(1).getCellRangeByName("TDSoth.TAN")
mIntCells = rangecells.ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
For mIntCtr = 0 To mIntCells - 1
If rangecells.getCellByPosition(0, mIntCtr).Type = EMPTY Then
ccount = ccount + 1
End If
Next
end_TDSoth = ccount
rngname_TDSoth = "TDSoth.TAN;TDSoth.EmployerOrDeductorOrCollecterName;TDSoth.TotTDSOnAmtPaid;TDSoth.ClaimOutOfTotTDSOnAmtPaid;"
End Sub
Sub setTblinfo_TDSoth2()
Dim rangecells As Object
Dim mIntCells As Integer
Dim mIntCtr As Integer
Dim ccount As Integer
ccount = 0
Set rangecells = ThisComponent.Sheets(1).getCellRangeByName("TDSoth.ClaimOutOfTotTDSOnAmtPaid")
mIntCells = rangecells.ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
For mIntCtr = 0 To mIntCells - 1
If rangecells.getCellByPosition(0, mIntCtr).Type = EMPTY Then
ccount = ccount + 1
End If
Next
end_TDSoth2 = ccount
rngname_TDSoth2 = "TDSoth.TAN;TDSoth.EmployerOrDeductorOrCollecterName;TDSoth.TotTDSOnAmtPaid;TDSoth.ClaimOutOfTotTDSOnAmtPaid;"
End Sub
Sub AddBlockCall_salrptfrm()
'setTblinfo_salrptfrm
Call addblock(rngname_salrptfrm, frmRngname_salrptfrm, cntrRng_salrptfrm, frmsize_salrptfrm)
End Sub
Function cmdFileDialog() As String
cmdFileDialog = ""
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.AllowMultiSelect = False
.Filters.Clear
.Filters.add "Microsoft Office Excel Workbook", "*.xls"
If .Show = True Then
For Each varFile In .SelectedItems
cmdFileDialog = varFile
Next
End If
End With
End Function
Function InsertRowsToImport(Optional vRows As Integer = 0)
Dim x As Long
msginit21 = Module3.getmsgstate
strpassword = msginit21 + "*"
ThisComponent.CurrentController.getActiveSheet.Unprotect Password:=strpassword
ActiveCell.EntireRow.Select 'So you do not have to preselect entire row
Dim sht As Worksheet, shts() As String, i As Integer
ReDim shts(1 To Worksheets.Application.ActiveWorkbook. _
Windows(1).SelectedSheets.count)
i = 0
For Each sht In _
Application.ActiveWorkbook.Windows(1).SelectedSheets
Sheets(sht.Name).Select
i = i + 1
shts(i) = sht.Name
x = Sheets(sht.Name).UsedRange.Rows.count 'lastcell fixup
Selection.Resize(rowsize:=2).Rows(2).EntireRow. _
Resize(rowsize:=vRows).Insert Shift:=xlDown
Selection.AutoFill Selection.Resize( _
rowsize:=vRows + 1), xlFillDefault
On Error Resume Next
Selection.Offset(1).Resize(vRows).EntireRow. _
SpecialCells(xlCellTypeAllValidation).ClearContents
'
Next sht
ThisComponent.CurrentController.getActiveSheet.Protect Password:=strpassword
End Function
Sub Import()
Dim flag As Boolean
Dim Filename As Variant
Dim dfilename, ndfilename As Variant
Dim add As Variant
Dim destadd As Variant
Dim a As Integer
Dim AB As Integer
flag = True
On Error Resume Next
MsgBox "Please Check the final ITR1 after importing to ensure all rows are inserted. "
'MsgBox "Nature of Business, enter Code manually after importing. Especially, check S.80G after importing to ensure correctness."
Filename = cmdFileDialog()
If Not Filename = "" Then
Filename = Split(Filename, "\")
newfilename = Filename(UBound(Filename))
Dim DestBook As Workbook, SrcBook As Workbook
Dim cnt As Integer
cnt = 0
Application.ScreenUpdating = False
Set SrcBook = Workbooks.Open(newfilename)
Set DestBook = ThisWorkbook
dfilename = Split((DestBook.FullName), "\")
ndfilename = dfilename(UBound(dfilename))
If newfilename <> ndfilename Then
For Each RNAME In Workbooks(newfilename).Names
If RNAME.Name = "TDSal.TAN" Then
sfirstbound = SrcBook.Sheets("TDS").getCellRangeByName(RNAME.Name).Address
sTEMP = Split(sfirstbound, "$")
supperbound = UBound(sTEMP)
sTEMP = sTEMP(UBound(sTEMP))
dfirstbound = DestBook.Sheets("TDS").getCellRangeByName(RNAME.Name).Address
dTemp = Split(dfirstbound, "$")
dupperbound = UBound(dTemp)
ddTemp = dTemp(UBound(dTemp))
cnt = SrcBook.Sheets("TDS").getCellRangeByName(RNAME.Name).ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
dcnt = DestBook.Sheets("TDS").getCellRangeByName(RNAME.Name).ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
DestBook.Sheets("TDS").Activate
If (cnt - dcnt) > 0 Then
DestBook.Sheets("TDS").Range(dTemp(UBound(dTemp) - 1) & dTemp(UBound(dTemp))).Select
setTblinfo_TDSal
InsertRowsToImport (cnt - dcnt)
Call ExendRangeNameToTable(cnt - dcnt, rngname_TDSal)
SrcBook.Sheets("TDS").Range(RNAME.Name).Copy
DestBook.Sheets("TDS").Range(RNAME.Name).PasteSpecial xlValues
Else
SrcBook.Sheets("TDS").Range(RNAME.Name).Copy
DestBook.Sheets("TDS").Range(RNAME.Name).PasteSpecial xlValues
End If
End If
If RNAME.Name = "TDSoth.TAN" Then
sfirstbound = SrcBook.Sheets("TDS").Range(RNAME.Name).Address
sTEMP = Split(sfirstbound, "$")
supperbound = UBound(sTEMP)
sTEMP = sTEMP(UBound(sTEMP))
dfirstbound = DestBook.Sheets("TDS").Range(RNAME.Name).Address
dTemp = Split(dfirstbound, "$")
dupperbound = UBound(dTemp)
ddTemp = dTemp(UBound(dTemp))
cnt = SrcBook.Sheets("TDS").getCellRangeByName(RNAME.Name).ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
dcnt = DestBook.Sheets("TDS").getCellRangeByName(RNAME.Name).ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
DestBook.Sheets("TDS").Activate
If (cnt - dcnt) > 0 Then
DestBook.Sheets("TDS").Range(dTemp(UBound(dTemp) - 1) & dTemp(UBound(dTemp))).Select
setTblinfo_TDSoth
InsertRowsToImport (cnt - dcnt)
Call ExendRangeNameToTable(cnt - dcnt, rngname_TDSoth)
SrcBook.Sheets("TDS").Range(RNAME.Name).Copy
DestBook.Sheets("TDS").Range(RNAME.Name).PasteSpecial xlValues
Else
SrcBook.Sheets("TDS").Range(RNAME.Name).Copy
DestBook.Sheets("TDS").Range(RNAME.Name).PasteSpecial xlValues
End If
End If
If RNAME.Name = "TaxP.BSRCode" Then
sfirstbound = SrcBook.Sheets("TDS").Range(RNAME.Name).Address
sTEMP = Split(sfirstbound, "$")
supperbound = UBound(sTEMP)
sTEMP = sTEMP(UBound(sTEMP))
dfirstbound = DestBook.Sheets("TDS").Range(RNAME.Name).Address
dTemp = Split(dfirstbound, "$")
dupperbound = UBound(dTemp)
ddTemp = dTemp(UBound(dTemp))
cnt = SrcBook.Sheets("TDS").getCellRangeByName(RNAME.Name).ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
dcnt = DestBook.Sheets("TDS").getCellRangeByName(RNAME.Name).ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
DestBook.Sheets("TDS").Activate
If (cnt - dcnt) > 0 Then
DestBook.Sheets("TDS").Range(dTemp(UBound(dTemp) - 1) & dTemp(UBound(dTemp))).Select
setTblinfo_TaxP
InsertRowsToImport (cnt - dcnt)
Call ExendRangeNameToTable(cnt - dcnt, rngname_TaxP)
SrcBook.Sheets("TDS").Range(RNAME.Name).Copy
DestBook.Sheets("TDS").Range(RNAME.Name).PasteSpecial xlValues
Else
SrcBook.Sheets("TDS").Range(RNAME.Name).Copy
DestBook.Sheets("TDS").Range(RNAME.Name).PasteSpecial xlValues
End If
End If
Next
a = 1
AB = 1
ReDim add(SrcBook.Worksheets.count)
ReDim destadd(SrcBook.Worksheets.count)
For Each ws In SrcBook.Worksheets
add(a) = ws.Name
a = a + 1
Next
For Each ws In DestBook.Worksheets
destadd(AB) = ws.Name
AB = AB + 1
Next
Application.EnableEvents = False
Dim NEWRNAME As Variant
Dim NEWSHEETNAME As Variant
For Each RNAME In Workbooks(newfilename).Names
NEWRNAME = RNAME.Name
NEWSHEETNAME = ""
If InStr(1, NEWRNAME, "!") > 0 Then
NEWRNAME = Mid(RNAME.Name, InStr(1, RNAME.Name, "!") + 1)
NEWSHEETNAME = Mid(RNAME.Name, 1, InStr(1, RNAME.Name, "!") - 1)
If UCase(NEWSHEETNAME) = "GENERAL" Then
NEWSHEETNAME = "Income Details"
End If
If UCase(NEWSHEETNAME) = "GENERAL2" Then
NEWSHEETNAME = "Taxes paid and Verification"
End If
'NEWRNAME = NEWSHEETNAME & NEWRNAME
End If
For a = 1 To UBound(add)
DestBook.Worksheets(destadd(a)).Activate
SrcBook.Worksheets(add(a)).Range(RNAME.Name).Copy
DestBook.Worksheets(destadd(a)).Range(NEWRNAME).PasteSpecial xlValues
Next
Next
Application.EnableEvents = True
MsgBox "Import Completed"
DestBook.Save
DestBook.Worksheets("Income Details").Select
Set SrcBook = Nothing
'On Error GoTo 0
Else
MsgBox "Source File must Not Have Same Name As Destination File"
End If
End If
End Sub
Sub AddRows_TaxP()
setTblinfo_TaxP
Dim numberofrows As Integer
SelectLastRow ("TaxP.BSRCode")
numberofrows = InsertRowsAndFillFormulas()
Call ExendRangeNameToTable(numberofrows, rngname_TaxP)
End Sub
Sub setTblinfo_TaxP()
Dim rangecells As Object
Dim mIntCells As Integer
Dim mIntCtr As Integer
Dim ccount As Integer
ccount = 0
Set rangecells = ThisComponent.Sheets(1).getCellRangeByName("TaxP.BSRCode")
mIntCells = rangecells.ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
For mIntCtr = 0 To mIntCells - 1
If rangecells.getCellByPosition(0, mIntCtr).Type = EMPTY Then
ccount = ccount + 1
End If
Next
end_TaxP = ccount
rngname_TaxP = "TaxP.BSRCode;TaxP.DateDep;TaxP.SrlNoOfChaln;TaxP.Amt;IT.FormulaOFS;"
End Sub
Sub setTblinfo_TaxP2()
Dim rangecells As Object
Dim mIntCells As Integer
Dim mIntCtr As Integer
Dim ccount As Integer
ccount = 0
Set rangecells = ThisComponent.Sheets(1).getCellRangeByName("TaxP.Amt")
mIntCells = rangecells.ComputeFunction(com.sun.star.sheet.GeneralFunction.COUNT)
For mIntCtr = 0 To mIntCells - 1
If rangecells.getCellByPosition(0, mIntCtr).Type = EMPTY Then
ccount = ccount + 1
End If
Next
end_TaxP2 = ccount
rngname_TaxP2 = "TaxP.BSRCode;TaxP.DateDep;TaxP.SrlNoOfChaln;TaxP.Amt;IT.FormulaOFS;"
End Sub
'---ValidateBlock
Sub Validateshts()
If Not Validatesheet1 Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(1-1))
MsgBox (msgValidateSheet1)
EndProcessing
End If
If Not ValidatesheetIncD Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(2))
MsgBox (msgValidateSheetIncD)
EndProcessing
End If
If Not ValidatesheetTDSal Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(1))
MsgBox (msgValidateSheetTDSal)
EndProcessing
End If
If Not ValidatesheetTDSoth Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(1))
MsgBox (msgValidateSheetTDSoth)
EndProcessing
End If
If Not ValidatesheetTaxP Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(1))
MsgBox (msgValidateSheetTaxP)
EndProcessing
End If
If Not ValidatesheetAIR Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(2))
MsgBox (msgValidateSheetAIR)
EndProcessing
End If
If Not ValidatesheetVer Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(2))
MsgBox (msgValidateSheetVer)
EndProcessing
End If
End Sub
'------ End ValidateBlock
'---Printerrormessage Functions
Sub printerrormessage_IncD()
If Not ValidatesheetIncD Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(2))
MsgBox (msgValidateSheetIncD)
EndProcessing
'Else
'MsgBox (" Sheet is ok ")
End If
printerrormessage_AIR
printerrormessage_Ver
End Sub
Sub printerrormessage_TDSal()
If Not ValidatesheetTDSal Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(3-1))
MsgBox (msgValidateSheetTDSal)
EndProcessing
'Else
'MsgBox (" Sheet is ok ")
End If
printerrormessage_TDSoth
printerrormessage_TaxP
End Sub
Sub printerrormessage_TDSoth()
If Not ValidatesheetTDSoth Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(3-1))
MsgBox (msgValidateSheetTDSoth)
EndProcessing
'Else
'MsgBox (" Sheet is ok ")
End If
End Sub
Sub printerrormessage_TaxP()
If Not ValidatesheetTaxP Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(3-1))
MsgBox (msgValidateSheetTaxP)
EndProcessing
Else
MsgBox (" Sheet is ok ")
End If
End Sub
Sub printerrormessage_AIR()
If Not ValidatesheetAIR Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(2))
MsgBox (msgValidateSheetAIR)
EndProcessing
'Else
'MsgBox (" Sheet is ok ")
End If
End Sub
Sub printerrormessage_Ver()
If Not ValidatesheetVer Then
ThisComponent.CurrentController.setActiveSheet(ThisComponent.Sheets(2))
MsgBox (msgValidateSheetVer)
EndProcessing
Else
MsgBox (" Sheet is ok ")
End If
End Sub
'------ End Printerrormessage Functions
Function msgbox_IncD(strmsg As String) As String
msgValidateSheetIncD = msgValidateSheetIncD & strmsg & Chr(13)
End Function
Function msgbox_TDSal(strmsg As String) As String
msgValidateSheetTDSal = msgValidateSheetTDSal & strmsg & Chr(13)
End Function
Function msgbox_TDSoth(strmsg As String) As String
msgValidateSheetTDSoth = msgValidateSheetTDSoth & strmsg & Chr(13)
End Function
Function msgbox_TaxP(strmsg As String) As String
msgValidateSheetTaxP = msgValidateSheetTaxP & strmsg & Chr(13)
End Function
Function msgbox_AIR(strmsg As String) As String
msgValidateSheetAIR = msgValidateSheetAIR & strmsg & Chr(13)
End Function
Function msgbox_Ver(strmsg As String) As String
msgValidateSheetVer = msgValidateSheetVer & strmsg & Chr(13)
End Function
'Main Validation Function
Function ValidatesheetIncD() As Boolean
ValidatesheetIncD = True
'If (Val(Sheet2.Range("IncD.TotalTaxesPaid")) > 0) Then
If Not ValidateAdvanceTax_IncD() Then ValidatesheetIncD = False
If Not ValidateTDS_IncD() Then ValidatesheetIncD = False
If Not ValidateSelfAssessmentTax_IncD() Then ValidatesheetIncD = False
If Not ValidateTotalTaxesPaid_IncD() Then ValidatesheetIncD = False
If Not ValidateBalTaxPayable_IncD() Then ValidatesheetIncD = False
'End If
If Not ValidateRefundDue_IncD() Then ValidatesheetIncD = False
If (ThisComponent.Sheets(2).getCellRangeByName("IncD.RefundDue").Value > 0) Then
If Not ValidateBankAccountNumber_IncD() Then ValidatesheetIncD = False
If Not ValidateEcsRequired_IncD() Then ValidatesheetIncD = False
If ThisComponent.Sheets(2).getCellRangeByName("IncD.EcsRequired").String = "Yes" Then
If Not ValidateMICRCode_IncD() Then ValidatesheetIncD = False
If Not ValidateBankAccountType_IncD() Then ValidatesheetIncD = False
End If
End If
End Function
Function ValidatesheetTDSal() As Boolean
ValidatesheetTDSal = True
If Not ValidateTAN_TDSal() Then ValidatesheetTDSal = False
If (Len(ThisComponent.Sheets(1).getCellRangeByName("TDSal.TAN").getCellByPosition(0, 1).String) > 0) Then
If Not ValidateEmployerOrDeductorOrCollecterName_TDSal() Then ValidatesheetTDSal = False
If Not ValidateAddrDetail_TDSal() Then ValidatesheetTDSal = False
If Not ValidateCityOrTownOrDistrict_TDSal() Then ValidatesheetTDSal = False
If Not ValidateStateCode_TDSal() Then ValidatesheetTDSal = False
If Not ValidatePinCode_TDSal() Then ValidatesheetTDSal = False
If Not ValidateIncChrgSal_TDSal() Then ValidatesheetTDSal = False
If Not ValidateDeductUnderChapVIA_TDSal() Then ValidatesheetTDSal = False
If Not ValidateTaxPayIncluSurchEdnCes_TDSal() Then ValidatesheetTDSal = False
If Not ValidateTotalTDSSal_TDSal() Then ValidatesheetTDSal = False
If Not ValidateTaxPayRefund_TDSal() Then ValidatesheetTDSal = False
End If
setTblinfo_TDSal2
'setTblinfo_TDSal
If (end_TDSal2 <> end_TDSal) Then
msgbox_TDSal ("Enter compulsory fields for Sch TDS from Salary ")
ValidatesheetTDSal = False
Exit Function
End If
End Function
Function ValidatesheetTDSoth() As Boolean
ValidatesheetTDSoth = True
If Not ValidateTAN_TDSoth() Then ValidatesheetTDSoth = False
If (Len(ThisComponent.Sheets(1).getCellRangeByName("TDSoth.TAN").getCellByPosition(0, 1).String) > 0) Then
If Not ValidateEmployerOrDeductorOrCollecterName_TDSoth() Then ValidatesheetTDSoth = False
If Not ValidateAddrDetail_TDSoth() Then ValidatesheetTDSoth = False
If Not ValidateCityOrTownOrDistrict_TDSoth() Then ValidatesheetTDSoth = False
If Not ValidateStateCode_TDSoth() Then ValidatesheetTDSoth = False
If Not ValidatePinCode_TDSoth() Then ValidatesheetTDSoth = False
If Not ValidateAmtPaid_TDSoth() Then ValidatesheetTDSoth = False
If Not ValidateDatePayCred_TDSoth() Then ValidatesheetTDSoth = False
If Not ValidateTotTDSOnAmtPaid_TDSoth() Then ValidatesheetTDSoth = False
If Not ValidateClaimOutOfTotTDSOnAmtPaid_TDSoth() Then ValidatesheetTDSoth = False
End If
setTblinfo_TDSoth2
If (end_TDSoth2 <> end_TDSoth) Then
msgbox_TDSoth ("Enter all compulsory fields for Sch TDS on Interest")
ValidatesheetTDSoth = False
Exit Function
End If
End Function
Function ValidatesheetTaxP() As Boolean
ValidatesheetTaxP = True
If Not ValidateBSRCode_TaxP() Then ValidatesheetTaxP = False
If (Len(ThisComponent.Sheets(1).getCellRangeByName("TaxP.BSRCode").getCellByPosition(0, 1).String) > 0) Then
If Not ValidateNameOfBank_TaxP() Then ValidatesheetTaxP = False
If Not ValidateNameOfBranch_TaxP() Then ValidatesheetTaxP = False
'If Not ValidateBSRCode_TaxP() Then ValidatesheetTaxP = False
If Not ValidateDateDep_TaxP() Then ValidatesheetTaxP = False
If Not ValidateSrlNoOfChaln_TaxP() Then ValidatesheetTaxP = False
If Not ValidateAmt_TaxP() Then ValidatesheetTaxP = False
End If
setTblinfo_TaxP2
If (end_TaxP2 <> end_TaxP) Then
msgbox_TaxP ("Details of Adv Tax and Self Asst Tax in Sheet TDS is Compulsory")
ValidatesheetTaxP = False
Exit Function
End If
End Function
Function ValidatesheetAIR() As Boolean
ValidatesheetAIR = True
If Not ValidateCode001_AIR() Then ValidatesheetAIR = False
If Not ValidateCode002_AIR() Then ValidatesheetAIR = False
If Not ValidateCode003_AIR() Then ValidatesheetAIR = False
If Not ValidateCode004_AIR() Then ValidatesheetAIR = False
If Not ValidateCode005_AIR() Then ValidatesheetAIR = False
If Not ValidateCode006_AIR() Then ValidatesheetAIR = False
If Not ValidateCode007_AIR() Then ValidatesheetAIR = False
If Not ValidateCode008_AIR() Then ValidatesheetAIR = False
If Not ValidateTaxExmpIntInc_AIR() Then ValidatesheetAIR = False
End Function
Function ValidatesheetVer() As Boolean
ValidatesheetVer = True
If Not ValidateAssesseeVerName_Ver() Then ValidatesheetVer = False
'If (Len(Sheet2.Range("Ver.AssesseeVerName")) > 0) Then
If Not ValidateFatherName_Ver() Then ValidatesheetVer = False
If Not ValidatePAN_Ver() Then ValidatesheetVer = False
If Not ValidatePlace_Ver() Then ValidatesheetVer = False
If Not ValidateDate_Ver() Then ValidatesheetVer = False
'End If
If (Len(ThisComponent.Sheets(2).getCellRangeByName("Ver.IdentificationNoOfTRP").String) > 0) Then
If Not ValidateIdentificationNoOfTRP_Ver() Then ValidatesheetVer = False
If Not ValidateNameOfTRP_Ver() Then ValidatesheetVer = False
If Not ValidateReImbFrmGov_Ver() Then ValidatesheetVer = False
End If
End Function
Function ValidateIncomeFromSal_IncD() As Boolean
ValidateIncomeFromSal_IncD = True
IncomeFromSal_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.IncomeFromSal").Value
End Function
Function checkhpresponse() As Integer
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "If the property is Occupied by you (Self occupied) /then the maximum you can claim is Rs -1,50,000. Is your property Self Occupied?"
Style = vbYesNo + vbInformation + vbDefaultButton1 ' Define buttons.
Title = "House Property" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
checkhpresponse = 6
Else
checkhpresponse = 7
End If
End Function
Function ValidateIncomeFromHP_IncD() As Boolean
Dim hpresponse As Integer
ValidateIncomeFromHP_IncD = True
IncomeFromHP_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.IncomeFromHP").Value
If IncomeFromHP_IncD < -150000 Then
hpresponse = checkhpresponse
If hpresponse = 6 Then
IncomeFromHP_IncD = -150000
ThisComponent.Sheets(1-1).getCellRangeByName("IncD.IncomeFromHP").Value = IncomeFromHP_IncD
End If
End If
End Function
Function ValidateFamPension_IncD() As Boolean
ValidateFamPension_IncD = True
FamPension_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.FamPension").Value
End Function
Function ValidateIndInterest_IncD() As Boolean
ValidateIndInterest_IncD = True
IndInterest_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.IndInterest").Value
End Function
Function ValidateIncomeFromOS_IncD() As Boolean
ValidateIncomeFromOS_IncD = True
IncomeFromOS_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.IncomeFromOS").Value
End Function
Function ValidateGrossTotIncome_IncD() As Boolean
ValidateGrossTotIncome_IncD = True
GrossTotIncome_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.GrossTotIncome").Value
End Function
Function ValidateSection80C_IncD() As Boolean
ValidateSection80C_IncD = True
Section80C_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80C").Value
End Function
Function ValidateSection80CCC_IncD() As Boolean
ValidateSection80CCC_IncD = True
Section80CCC_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80CCC").Value
End Function
Function ValidateSection80CCD_IncD() As Boolean
ValidateSection80CCD_IncD = True
Section80CCD_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80CCD").Value
End Function
Function ValidateSection80CCF_IncD() As Boolean
ValidateSection80CCF_IncD = True
Section80CCF_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80CCF").Value
End Function
Function ValidateSection80D_IncD() As Boolean
ValidateSection80D_IncD = True
Section80D_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80D").Value
End Function
Function ValidateSection80DD_IncD() As Boolean
ValidateSection80DD_IncD = True
Section80DD_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80DD").Value
End Function
Function ValidateSection80DDB_IncD() As Boolean
ValidateSection80DDB_IncD = True
Section80DDB_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80DDB").Value
End Function
Function ValidateSection80E_IncD() As Boolean
ValidateSection80E_IncD = True
Section80E_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80E").Value
End Function
Function ValidateSection80G_IncD() As Boolean
ValidateSection80G_IncD = True
Section80G_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80G").Value
End Function
Function ValidateSection80GG_IncD() As Boolean
ValidateSection80GG_IncD = True
Section80GG_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80GG").Value
End Function
Function ValidateSection80GGA_IncD() As Boolean
ValidateSection80GGA_IncD = True
Section80GGA_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80GGA").Value
End Function
Function ValidateSection80GGC_IncD() As Boolean
ValidateSection80GGC_IncD = True
Section80GGC_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80GGC").Value
End Function
Function ValidateSection80U_IncD() As Boolean
ValidateSection80U_IncD = True
Section80U_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.Section80U").Value
End Function
Function ValidateTotalChapVIADeductions_IncD() As Boolean
ValidateTotalChapVIADeductions_IncD = True
TotalChapVIADeductions_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.TotalChapVIADeductions").Value
End Function
Function ValidateTotalIncome_IncD() As Boolean
ValidateTotalIncome_IncD = True
TotalIncome_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.TotalIncome").Value
End Function
Function ValidateNetAgriculturalIncome_IncD() As Boolean
ValidateNetAgriculturalIncome_IncD = True
NetAgriculturalIncome_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.NetAgriculturalIncome").Value
End Function
Function ValidateAggregateIncome_IncD() As Boolean
ValidateAggregateIncome_IncD = True
AggregateIncome_IncD = ThisComponent.Sheets(1-1).getCellRangeByName("IncD.AggregateIncome").Value