@@ -146,6 +146,9 @@ discard block  | 
                                                    ||
| 146 | 146 | ];  | 
                                                        
| 147 | 147 | }  | 
                                                        
| 148 | 148 | |
| 149 | + /**  | 
                                                        |
| 150 | + * @param double $lngBase  | 
                                                        |
| 151 | + */  | 
                                                        |
| 149 | 152 | private function getValues($lngBase)  | 
                                                        
| 150 | 153 |      { | 
                                                        
| 151 | 154 | $aReturn['cas'] = $this->setHealthFundTax($_REQUEST['ym'], $lngBase);  | 
                                                        
@@ -406,6 +409,9 @@ discard block  | 
                                                    ||
| 406 | 409 | ]), 'fieldset', ['style' => 'float: left;']);  | 
                                                        
| 407 | 410 | }  | 
                                                        
| 408 | 411 | |
| 412 | + /**  | 
                                                        |
| 413 | + * @param string $text  | 
                                                        |
| 414 | + */  | 
                                                        |
| 409 | 415 | private function setFormRow($text, $value, $type = 'amount')  | 
                                                        
| 410 | 416 |      { | 
                                                        
| 411 | 417 | $a = '';  | 
                                                        
@@ -60,7 +60,7 @@ discard block  | 
                                                    ||
| 60 | 60 | |
| 61 | 61 | private function getExchangeRates()  | 
                                                        
| 62 | 62 |      { | 
                                                        
| 63 | - $this->appFlags['currency_exchanges'] = [  | 
                                                        |
| 63 | + $this->appFlags['currency_exchanges'] = [  | 
                                                        |
| 64 | 64 | 'RON' => [  | 
                                                        
| 65 | 65 | 'decimals' => 2,  | 
                                                        
| 66 | 66 | 'locale' => 'ro_RO',  | 
                                                        
@@ -164,7 +164,7 @@ discard block  | 
                                                    ||
| 164 | 164 | $aReturn['somaj'],  | 
                                                        
| 165 | 165 | $aReturn['pd'],  | 
                                                        
| 166 | 166 | ];  | 
                                                        
| 167 | - $rest = $lngBase - array_sum($restArrayToDeduct);  | 
                                                        |
| 167 | + $rest = $lngBase - array_sum($restArrayToDeduct);  | 
                                                        |
| 168 | 168 |          if ($_REQUEST['ym'] >= mktime(0, 0, 0, 7, 1, 2010)) { | 
                                                        
| 169 | 169 | $rest += round($aReturn['ba'], -4);  | 
                                                        
| 170 | 170 | }  | 
                                                        
@@ -240,7 +240,7 @@ discard block  | 
                                                    ||
| 240 | 240 | 'value' => $_REQUEST['pn'],  | 
                                                        
| 241 | 241 | 'size' => 10  | 
                                                        
| 242 | 242 | ]) . ' RON', 1);  | 
                                                        
| 243 | - $pieces = [  | 
                                                        |
| 243 | + $pieces = [  | 
                                                        |
| 244 | 244 |              $this->tApp->gettext('i18n_Form_Label_OvertimeHours'), | 
                                                        
| 245 | 245 |              $this->tApp->gettext('i18n_Form_Label_OvertimeChoice1'), | 
                                                        
| 246 | 246 | ];  | 
                                                        
@@ -251,7 +251,7 @@ discard block  | 
                                                    ||
| 251 | 251 | 'value' => $_REQUEST['os175'],  | 
                                                        
| 252 | 252 | 'size' => 2  | 
                                                        
| 253 | 253 | ]), 1);  | 
                                                        
| 254 | - $pieces = [  | 
                                                        |
| 254 | + $pieces = [  | 
                                                        |
| 255 | 255 |              $this->tApp->gettext('i18n_Form_Label_OvertimeHours'), | 
                                                        
| 256 | 256 |              $this->tApp->gettext('i18n_Form_Label_OvertimeChoice2'), | 
                                                        
| 257 | 257 | ];  | 
                                                        
@@ -323,7 +323,7 @@ discard block  | 
                                                    ||
| 323 | 323 | 'id' => 'submit',  | 
                                                        
| 324 | 324 | 'value' => $submitBtnTxt  | 
                                                        
| 325 | 325 | ]), 1);  | 
                                                        
| 326 | -        $frm       = $this->setStringIntoTag($this->setStringIntoTag(implode('', $sReturn), 'table'), 'form', [ | 
                                                        |
| 326 | +        $frm = $this->setStringIntoTag($this->setStringIntoTag(implode('', $sReturn), 'table'), 'form', [ | 
                                                        |
| 327 | 327 | 'method' => 'get',  | 
                                                        
| 328 | 328 | 'action' => $_SERVER['SCRIPT_NAME']  | 
                                                        
| 329 | 329 | ]);  | 
                                                        
@@ -111,7 +111,7 @@ discard block  | 
                                                    ||
| 111 | 111 | 2015 => min($lngBrutto, 5 * 24150000),  | 
                                                        
| 112 | 112 | 2016 => min($lngBrutto, 5 * 26810000),  | 
                                                        
| 113 | 113 | ];  | 
                                                        
| 114 | - $base = $lngBrutto;  | 
                                                        |
| 114 | + $base = $lngBrutto;  | 
                                                        |
| 115 | 115 |          if ($givenYear == 2005) { | 
                                                        
| 116 | 116 | $base = min($lngBrutto, 5 * 9210000);  | 
                                                        
| 117 | 117 |              if (date('n', $lngDate) <= 6) { | 
                                                        
@@ -192,37 +192,37 @@ discard block  | 
                                                    ||
| 192 | 192 |      { | 
                                                        
| 193 | 193 |          $mnth = date('n', $lngDate); | 
                                                        
| 194 | 194 |          if ($mnth <= 6) { | 
                                                        
| 195 | - $nReturn = 1822070 + ($lngTaxBase - 6867000 ) * 40 / 100;  | 
                                                        |
| 195 | + $nReturn = 1822070 + ($lngTaxBase - 6867000) * 40 / 100;  | 
                                                        |
| 196 | 196 |              if ($lngTaxBase <= 1259000) { | 
                                                        
| 197 | 197 | $nReturn = $lngTaxBase * 18 / 100;  | 
                                                        
| 198 | 198 |              } elseif ($lngTaxBase <= 3090000) { | 
                                                        
| 199 | - $nReturn = 226620 + ($lngTaxBase - 1259000 ) * 23 / 100;  | 
                                                        |
| 199 | + $nReturn = 226620 + ($lngTaxBase - 1259000) * 23 / 100;  | 
                                                        |
| 200 | 200 |              } elseif ($lngTaxBase <= 4921000) { | 
                                                        
| 201 | - $nReturn = 647750 + ($lngTaxBase - 3090000 ) * 28 / 100;  | 
                                                        |
| 201 | + $nReturn = 647750 + ($lngTaxBase - 3090000) * 28 / 100;  | 
                                                        |
| 202 | 202 |              } elseif ($lngTaxBase <= 6867000) { | 
                                                        
| 203 | - $nReturn = 1160430 + ($lngTaxBase - 4921000 ) * 34 / 100;  | 
                                                        |
| 203 | + $nReturn = 1160430 + ($lngTaxBase - 4921000) * 34 / 100;  | 
                                                        |
| 204 | 204 | }  | 
                                                        
| 205 | 205 |          } elseif ($mnth <= 9) { | 
                                                        
| 206 | - $nReturn = 2109940 + ($lngTaxBase - 7952000 ) * 40 / 100;  | 
                                                        |
| 206 | + $nReturn = 2109940 + ($lngTaxBase - 7952000) * 40 / 100;  | 
                                                        |
| 207 | 207 |              if ($lngTaxBase <= 1458000) { | 
                                                        
| 208 | 208 | $nReturn = $lngTaxBase * 18 / 100;  | 
                                                        
| 209 | 209 |              } elseif ($lngTaxBase <= 3578000) { | 
                                                        
| 210 | - $nReturn = 262440 + ($lngTaxBase - 1458000 ) * 23 / 100;  | 
                                                        |
| 210 | + $nReturn = 262440 + ($lngTaxBase - 1458000) * 23 / 100;  | 
                                                        |
| 211 | 211 |              } elseif ($lngTaxBase <= 5699000) { | 
                                                        
| 212 | - $nReturn = 750040 + ($lngTaxBase - 3578000 ) * 28 / 100;  | 
                                                        |
| 212 | + $nReturn = 750040 + ($lngTaxBase - 3578000) * 28 / 100;  | 
                                                        |
| 213 | 213 |              } elseif ($lngTaxBase <= 7952000) { | 
                                                        
| 214 | - $nReturn = 1343920 + ($lngTaxBase - 5699000 ) * 34 / 100;  | 
                                                        |
| 214 | + $nReturn = 1343920 + ($lngTaxBase - 5699000) * 34 / 100;  | 
                                                        |
| 215 | 215 | }  | 
                                                        
| 216 | 216 |          } elseif ($mnth > 9) { | 
                                                        
| 217 | - $nReturn = 2231000 + ($lngTaxBase - 8400000 ) * 40 / 100;  | 
                                                        |
| 217 | + $nReturn = 2231000 + ($lngTaxBase - 8400000) * 40 / 100;  | 
                                                        |
| 218 | 218 |              if ($lngTaxBase <= 1500000) { | 
                                                        
| 219 | 219 | $nReturn = $lngTaxBase * 18 / 100;  | 
                                                        
| 220 | 220 |              } elseif ($lngTaxBase <= 3800000) { | 
                                                        
| 221 | - $nReturn = 270000 + ($lngTaxBase - 1500000 ) * 23 / 100;  | 
                                                        |
| 221 | + $nReturn = 270000 + ($lngTaxBase - 1500000) * 23 / 100;  | 
                                                        |
| 222 | 222 |              } elseif ($lngTaxBase <= 6000000) { | 
                                                        
| 223 | - $nReturn = 799000 + ($lngTaxBase - 3800000 ) * 28 / 100;  | 
                                                        |
| 223 | + $nReturn = 799000 + ($lngTaxBase - 3800000) * 28 / 100;  | 
                                                        |
| 224 | 224 |              } elseif ($lngTaxBase <= 8400000) { | 
                                                        
| 225 | - $nReturn = 1415000 + ($lngTaxBase - 6000000 ) * 34 / 100;  | 
                                                        |
| 225 | + $nReturn = 1415000 + ($lngTaxBase - 6000000) * 34 / 100;  | 
                                                        |
| 226 | 226 | }  | 
                                                        
| 227 | 227 | }  | 
                                                        
| 228 | 228 | return $nReturn;  | 
                                                        
@@ -230,45 +230,45 @@ discard block  | 
                                                    ||
| 230 | 230 | |
| 231 | 231 | private function setIncomeTax2002($lngTaxBase)  | 
                                                        
| 232 | 232 |      { | 
                                                        
| 233 | - $nReturn = 2710000 + ($lngTaxBase - 10200000 ) * 40 / 100;  | 
                                                        |
| 233 | + $nReturn = 2710000 + ($lngTaxBase - 10200000) * 40 / 100;  | 
                                                        |
| 234 | 234 |          if ($lngTaxBase <= 1800000) { | 
                                                        
| 235 | 235 | $nReturn = $lngTaxBase * 18 / 100;  | 
                                                        
| 236 | 236 |          } elseif ($lngTaxBase <= 4600000) { | 
                                                        
| 237 | - $nReturn = 324000 + ($lngTaxBase - 1800000 ) * 23 / 100;  | 
                                                        |
| 237 | + $nReturn = 324000 + ($lngTaxBase - 1800000) * 23 / 100;  | 
                                                        |
| 238 | 238 |          } elseif ($lngTaxBase <= 7300000) { | 
                                                        
| 239 | - $nReturn = 968000 + ($lngTaxBase - 4600000 ) * 28 / 100;  | 
                                                        |
| 239 | + $nReturn = 968000 + ($lngTaxBase - 4600000) * 28 / 100;  | 
                                                        |
| 240 | 240 |          } elseif ($lngTaxBase <= 10200000) { | 
                                                        
| 241 | - $nReturn = 1724000 + ($lngTaxBase - 7300000 ) * 34 / 100;  | 
                                                        |
| 241 | + $nReturn = 1724000 + ($lngTaxBase - 7300000) * 34 / 100;  | 
                                                        |
| 242 | 242 | }  | 
                                                        
| 243 | 243 | return $nReturn;  | 
                                                        
| 244 | 244 | }  | 
                                                        
| 245 | 245 | |
| 246 | 246 | private function setIncomeTax2003($lngTaxBase)  | 
                                                        
| 247 | 247 |      { | 
                                                        
| 248 | - $nReturn = 3081000 + ($lngTaxBase - 11600000 ) * 40 / 100;  | 
                                                        |
| 248 | + $nReturn = 3081000 + ($lngTaxBase - 11600000) * 40 / 100;  | 
                                                        |
| 249 | 249 |          if ($lngTaxBase <= 2100000) { | 
                                                        
| 250 | 250 | $nReturn = ($lngTaxBase * 18) / 100;  | 
                                                        
| 251 | 251 |          } elseif ($lngTaxBase <= 5200000) { | 
                                                        
| 252 | - $nReturn = 324000 + ($lngTaxBase - 2100000 ) * 23 / 100;  | 
                                                        |
| 252 | + $nReturn = 324000 + ($lngTaxBase - 2100000) * 23 / 100;  | 
                                                        |
| 253 | 253 |          } elseif ($lngTaxBase <= 8300000) { | 
                                                        
| 254 | - $nReturn = 1091000 + ($lngTaxBase - 5200000 ) * 28 / 100;  | 
                                                        |
| 254 | + $nReturn = 1091000 + ($lngTaxBase - 5200000) * 28 / 100;  | 
                                                        |
| 255 | 255 |          } elseif ($lngTaxBase <= 11600000) { | 
                                                        
| 256 | - $nReturn = 1959000 + ($lngTaxBase - 8300000 ) * 34 / 100;  | 
                                                        |
| 256 | + $nReturn = 1959000 + ($lngTaxBase - 8300000) * 34 / 100;  | 
                                                        |
| 257 | 257 | }  | 
                                                        
| 258 | 258 | return $nReturn;  | 
                                                        
| 259 | 259 | }  | 
                                                        
| 260 | 260 | |
| 261 | 261 | private function setIncomeTax2004($lngTaxBase)  | 
                                                        
| 262 | 262 |      { | 
                                                        
| 263 | - $nReturn = 3452000 + ($lngTaxBase - 13000000 ) * 40 / 100;  | 
                                                        |
| 263 | + $nReturn = 3452000 + ($lngTaxBase - 13000000) * 40 / 100;  | 
                                                        |
| 264 | 264 |          if ($lngTaxBase <= 2400000) { | 
                                                        
| 265 | 265 | $nReturn = ($lngTaxBase * 18) / 100;  | 
                                                        
| 266 | 266 |          } elseif ($lngTaxBase <= 5800000) { | 
                                                        
| 267 | - $nReturn = 432000 + ($lngTaxBase - 2400000 ) * 23 / 100;  | 
                                                        |
| 267 | + $nReturn = 432000 + ($lngTaxBase - 2400000) * 23 / 100;  | 
                                                        |
| 268 | 268 |          } elseif ($lngTaxBase <= 9300000) { | 
                                                        
| 269 | - $nReturn = 1214000 + ($lngTaxBase - 5800000 ) * 28 / 100;  | 
                                                        |
| 269 | + $nReturn = 1214000 + ($lngTaxBase - 5800000) * 28 / 100;  | 
                                                        |
| 270 | 270 |          } elseif ($lngTaxBase <= 13000000) { | 
                                                        
| 271 | - $nReturn = 2194000 + ($lngTaxBase - 9300000 ) * 34 / 100;  | 
                                                        |
| 271 | + $nReturn = 2194000 + ($lngTaxBase - 9300000) * 34 / 100;  | 
                                                        |
| 272 | 272 | }  | 
                                                        
| 273 | 273 | return $nReturn;  | 
                                                        
| 274 | 274 | }  | 
                                                        
@@ -113,6 +113,9 @@  | 
                                                    ||
| 113 | 113 | return $nReturn;  | 
                                                        
| 114 | 114 | }  | 
                                                        
| 115 | 115 | |
| 116 | + /**  | 
                                                        |
| 117 | + * @return double  | 
                                                        |
| 118 | + */  | 
                                                        |
| 116 | 119 | private function setPersonalDeductionComplex($sPersons, $lngBrutto, $inRule)  | 
                                                        
| 117 | 120 |      { | 
                                                        
| 118 | 121 | $nDeduction = $inRule['Limit maximum amount'];  | 
                                                        
@@ -88,7 +88,7 @@ discard block  | 
                                                    ||
| 88 | 88 | 2003 => 1800000,  | 
                                                        
| 89 | 89 | 2004 => 2000000,  | 
                                                        
| 90 | 90 | ];  | 
                                                        
| 91 | - $nReturn = $valuesYearly[$yrDate];  | 
                                                        |
| 91 | + $nReturn = $valuesYearly[$yrDate];  | 
                                                        |
| 92 | 92 | }  | 
                                                        
| 93 | 93 |          if ($lngDate >= mktime(0, 0, 0, 7, 1, 2006)) { | 
                                                        
| 94 | 94 | $nReturn = round($nReturn, -4);  | 
                                                        
@@ -131,7 +131,7 @@ discard block  | 
                                                    ||
| 131 | 131 | 'Reduced deduction' => 10000000,  | 
                                                        
| 132 | 132 | ],  | 
                                                        
| 133 | 133 | ];  | 
                                                        
| 134 | - $inRule = $nValues[2005];  | 
                                                        |
| 134 | + $inRule = $nValues[2005];  | 
                                                        |
| 135 | 135 |          if ($yrDate == 2016) { | 
                                                        
| 136 | 136 | $inRule = $nValues[2016];  | 
                                                        
| 137 | 137 | }  |