Procedure c_calcul_ir.compute_ir;
Var l_micro_foncier_net: Double;
Procedure _calcul_csg_crds_loyers;
Var l_base_flat_tax: Double;
Procedure __display_and_add_csg(p_title: String; p_rate, p_base: Double);
Var l_rate, l_amount: Double;
Begin
l_amount:= p_base* p_rate/ 100;
display(Format('%-35s %10s %5.2f %10s',
[p_title, f_10_2(p_base), p_rate, f_10_2(l_amount)]));
m_total_csg_crds:= m_total_csg_crds+ l_amount;
End; // __display_and_add_csg
Var l_flat_tax_csg: Double;
l_full_flat_tax: Double;
Begin // _calcul_csg_crds_loyers m_total_csg_crds:= 0;
display(f_display('micro_foncier_net', l_micro_foncier_net));
l_flat_tax_csg:= f_rate('flat_tax_CSG')+ f_rate('flat_tax_CRDS')
+ f_rate('flat_tax_solidarite'); display_line;
__display_and_add_csg('flat_tax_csg', l_flat_tax_csg, l_micro_foncier_net);
l_base_flat_tax:= 0; display_line;
display(f_display('interets_associes', m_c_calcul_is_ref.m_interets_compte_associe));
display(f_display('dividendes', m_c_calcul_is_ref.m_dividendes));
l_base_flat_tax:= m_c_calcul_is_ref.m_interets_compte_associe+ m_c_calcul_is_ref.m_dividendes;
display_line;
display(f_display(' = base_csg_crds', l_base_flat_tax));
display_line;
l_full_flat_tax:= l_flat_tax_csg+ f_rate('flat_tax_taux_forfaitaire');
__display_and_add_csg('flat_tax', l_full_flat_tax, l_base_flat_tax);
display_line;
display(f_display_2('total_csg_flat_tax', 28, m_total_csg_crds));
End; // _calcul_csg_crds_loyers
Var l_total_revenus: Double;
Procedure _display_and_add_revenu(p_title: String; p_amount: Double);
Begin
display(f_display(p_title, p_amount));
l_total_revenus:= l_total_revenus+ p_amount;
End; // _display_and_add_revenu
Var l_total_impots: Double;
Procedure _display_and_add_impots(p_title: String; p_amount: Double);
Var l_display: String; Begin
l_display:= f_display(p_title, p_amount);
If m_ir_precedent<> 0 Then
If pos('IR', p_title)> 0
Then l_display:= l_display+ Format('%s [%10.2f]',
[f_spaces(2), p_amount- m_ir_precedent])
Else
If Pos('CSG', p_title)> 0
Then l_display:= l_display+ Format('%s [%10.2f]',
[f_spaces(2), p_amount- m_total_csg_crds_precedent]);
display(l_display);
l_total_impots:= l_total_impots+ p_amount;
End; // _display_and_add_impots
Var l_revenu_net_imposable: Double;
l_revenu_brut_global: Double;
l_revenu_imposable: Double;
l_revenu_imposable_par_part: double;
l_impot_par_tranches: Double;
l_impot_taux_forfaitaire: Double;
l_tranche_index: Integer;
l_base, l_amount, l_total: Double;
l_seuil: String;
l_c_save_display_strings: tStrings; Begin // compute_ir
display_line; display(m_title); display_line;
display(f_display('salaires', m_revenu_imposable));
If m_csg_deductible_ir> 0
Then display(f_display(' + csg_deductible', m_csg_deductible_ir));
display(f_display(' + retraites', m_retraites));
m_revenu_imposable:= m_revenu_imposable+ m_csg_deductible_ir+ m_retraites;
display_line; l_revenu_net_imposable:= 0.90* m_revenu_imposable;
l_micro_foncier_net:= m_c_calcul_is_ref.m_micro_foncier_brut* 0.70;
l_revenu_brut_global:= l_revenu_net_imposable+ l_micro_foncier_net;
l_revenu_imposable:= l_revenu_brut_global- m_csg_deductible_ir;
display(f_display('= revenu_imposable', m_revenu_imposable));
display(f_display(' - frais_10_%% ', 0.10* m_revenu_imposable));
display(f_display('= revenu_net_imposable', l_revenu_net_imposable));
display(f_display(' + micro_foncier_net', l_micro_foncier_net)
+ Format(' (0.70 * foncier %10f.3)', [m_c_calcul_is_ref.m_micro_foncier_brut]));
display(f_display('= revenu_brut_global', l_revenu_brut_global));
display(f_display('csg_deductible', m_csg_deductible_ir));
display(f_display('revenu_imposable', l_revenu_imposable));
If m_delta_net> 0
Then display(f_display('delta_net_??? ', m_delta_net));
display_line; l_total:= 0;
l_revenu_imposable:= l_revenu_imposable+ m_delta_net;
l_c_save_display_strings:= s_lines;
initialize_display(m_c_detail_result_list); clear_display;
display(f_display('revenu_imposable', l_revenu_imposable));
l_revenu_imposable_par_part:= l_revenu_imposable/ m_nombre_parts;
display(f_display('revenu_imposable_par_part', l_revenu_imposable_par_part));
display_line; l_impot_par_tranches:= 0;
For l_tranche_index:= 1 To m_tranche_count- 1 Do
If l_revenu_imposable_par_part> m_seuil_array[l_tranche_index- 1]
Then Begin
l_base:= Min(l_revenu_imposable_par_part, m_seuil_array[l_tranche_index]);
l_base:= l_base- m_seuil_array[l_tranche_index- 1];
l_amount:= l_base* m_taux_array[l_tranche_index]/ 100;
If m_seuil_array[l_tranche_index]= k_max
Then l_seuil:= f_spaces(10)
Else l_seuil:= Format('%10s', [f_10_2(m_seuil_array[l_tranche_index]) ]);
display(Format('%d %10s %10s %6.2f %10s',
[l_tranche_index, l_seuil, f_10_2(l_base),
m_taux_array[l_tranche_index], f_10_2(l_amount)]));
l_total:= l_total+ l_amount;
End; display_line;
display(Format('%-35s %10s', ['total', f_10_2(l_total)]));
m_IR:= l_total* m_nombre_parts; display_line;
display(Format('total_pour_%1.1f_parts %s %10s %3.2f %%',
[m_nombre_parts, f_spaces(14), f_10_2(m_IR), m_IR/ l_revenu_imposable] ));
initialize_display(l_c_save_display_strings);
display(f_display('impot_a_payer', m_IR));
l_total:= l_impot_par_tranches+ l_impot_taux_forfaitaire;
initialize_display(m_c_detail_result_list); display_line;
display_line; _calcul_csg_crds_loyers;
initialize_display(l_c_save_display_strings); display_line;
End; // compute_ir |