{
IRG 2022 Function By Boussaid Mustafa
APC SALI 2022
Usage:
//Normal
Edit2.Text:=FormatFloat('# ##0.00',IRG2022New(StrToFloat(Edit1.Text),1));
//Handicape
Edit2.Text:=FormatFloat('# ##0.00',IRG2022New(StrToFloat(Edit1.Text),2));
}
Function IRG2022New(soumis: real;TypeIrg:integer) : real;
var
T00,T01,T02,T03,T04: integer;
irg, abat, p: real;
begin
T00:= 20000;
T01:= 4600;
T02:= 10800;
T03:= 24000;
T04:= 52800;
p := (Int(soumis / 10)) * 10;
if (soumis > 30009) And (soumis <= 40000) then irg := (p - T00) * 0.23
else if (soumis > 40000) And (soumis <= 80000) then irg := (P - 40000) * 0.27 + T01
else if (soumis > 80000) And (soumis <= 160000) then irg := (P - 80000) * 0.30 + T01 + T02
else if (soumis > 160000) And (soumis <= 320000) then irg := (P - 160000) * 0.33 + T01 + T02 + T03
else Irg := (P - 320000) * 0.35 + T01 + T02 + T03 + T04;
abat := irg * 0.4;
If abat < 1000 then abat := 1000;
If abat > 1500 then abat := 1500;
irg := irg - abat;
// 1= Normal 2= Handicape
if TypeIrg = 1 then begin //---->Normal
if soumis < 35000 then irg := (irg * 137/51) - (27925/8)
end
else begin //---->Handicape
if soumis < 42500 then irg := (irg * 93/61) - (81213/41)
end;
if soumis < 30010 then irg := 0;
Result:= RoundTo(irg, -1);
end;