@@ -46,13 +46,13 @@ public function calculate(Request $request)
46
46
$ income = (int ) ($ request ->yearly_income ?? 0 );
47
47
$ turnover = (int ) ($ request ->yearly_turnover ?? 0 );
48
48
$ asset = (int ) ($ request ->total_asset ?? 0 );
49
+ $ assetPercentage = $ this ->calcTax ($ asset , $ request , 'asset ' );
49
50
$ incomeTaxAll = $ this ->calcTax ($ income , $ request , 'income ' );
50
51
$ turnoverTaxAll = $ this ->calcTax ($ turnover , $ request , 'turnover ' );
51
52
$ incomeTax = $ incomeTaxAll ['tax ' ];
52
53
$ turnoverTax = $ turnoverTaxAll ['tax ' ];
53
54
$ minTaxApplied = $ incomeTax > $ turnoverTax ? $ incomeTaxAll ['min-tax-applied ' ] : $ turnoverTaxAll ['min-tax-applied ' ];
54
55
$ originalTax = $ incomeTax > $ turnoverTax ? $ incomeTaxAll ['original-tax ' ] : $ turnoverTaxAll ['original-tax ' ];
55
- $ assetPercentage = $ this ->calcTax ($ asset , $ request , 'asset ' );
56
56
57
57
$ assetTax = ($ incomeTax > $ turnoverTax ) ? $ incomeTax * ($ assetPercentage / 100 ) : $ turnoverTax * ($ assetPercentage / 100 );
58
58
$ tax = $ turnoverTax > $ incomeTax ? $ turnoverTax : $ incomeTax ;
@@ -73,14 +73,14 @@ public function calculate(Request $request)
73
73
'*Tax Paid a or b which is higher ' .($ minTaxApplied ? "<br> <small>Min. Tax Applied( {$ formatMinTax })</small> " : '' ) => currencyFormat ($ tax ),
74
74
],
75
75
'add ' => [
76
- 'WealthTax ' => currencyFormat ($ assetTax ),
76
+ 'WealthTax ' => " + " . currencyFormat ($ assetTax ),
77
77
'*Total Payable Tax ' => currencyFormat ($ totalTax ),
78
78
],
79
79
'less ' => [
80
- 'Rebate ' => "- " .currencyFormat ($ request ->rebate ?? 0 ),
80
+ 'Rebate ' => "- " .currencyFormat ($ request ->rebate ?? 0 ),
81
81
'After Rebate ' => $ originalTax == 0 ? "<div class='text-center' style='border-bottom: 2px solid rgb(14 159 110);'> {$ afterRebateFormatted }</div> " : $ afterRebateFormatted ,
82
82
'Apply Min-Tax ' => $ afterRebate < $ minTax && $ originalTax > 0 ? currencyFormat ($ minTax ) : 'Not Applied ' ,
83
- "Others Paid " => $ originalTax == 0 ? "<div class='text-center' style='border-bottom: 2px solid rgb(14 159 110);'>No Deduction applicable</div> " : "- " .$ formattedDeduction
83
+ "Others Paid " => $ originalTax == 0 ? "<div class='text-center' style='border-bottom: 2px solid rgb(14 159 110);'>No Deduction applicable</div> " : "- " .$ formattedDeduction
84
84
// 'Others Paid' => "-".$formattedDeduction,
85
85
// '*Total Deduction' => currencyFormat($totalTax - $afterDeduction)
86
86
],
@@ -166,10 +166,11 @@ public function calcTax(int $value, $request, string $type)
166
166
'female ' => (int ) $ taxSetting ->tax_free ->female ,
167
167
null => (int ) $ taxSetting ->tax_free ->amount ?? 0 ,
168
168
};
169
+ $ afterFree = $ value - $ taxFree ;
169
170
} else {
170
171
$ taxFree = 0 ;
172
+ $ afterFree = $ value - $ taxFree ;
171
173
}
172
- $ afterFree = $ value - $ taxFree ;
173
174
$ minTax = $ taxSetting ->min_tax ?? 0 ;
174
175
$ lastValueSlot = $ taxSetting ->slots ()->where ('type ' , $ type )
175
176
->where ('from ' , '<= ' , $ afterFree )
@@ -183,7 +184,7 @@ public function calcTax(int $value, $request, string $type)
183
184
* For Asset Type just return the last value slot percentage
184
185
*/
185
186
if ($ type == 'asset ' ) {
186
- return $ lastValueSlot ->percentage ?? 0 ;
187
+ return $ lastValueSlot ->tax_percentage ?? 0 ;
187
188
}
188
189
$ slotLimit = $ lastValueSlot ?->to ?? 0 ;
189
190
$ slots = $ taxSetting ->slots ()->where ('type ' , $ type )->where ('to ' , '<= ' , $ slotLimit )->get ();
0 commit comments