I could get something interesting by changing this in the script:
procedure start_kpi;
begin
form1.label2.caption := 'TOTAL CLAIMS: ' + floattostr(sqlexecute('select SUM(claimvalue) from expenses')) + ' £ (100%)';
end;
procedure employee_kpi;
var vbar: int;
var vclaimno: currency;
begin
vbar := sqlexecute('select SUM(claimvalue) from expenses where id_employee =' +floattostr(form1.tablegrid1.dbitemid))/sqlexecute('select SUM(claimvalue) from expenses')*100.0;
// form1.panel2.width := 10;
form1.panel2.width := form1.panel2.width + (vbar * 4);
vclaimno := sqlexecute('select SUM(claimvalue) from expenses where id_employee =' +floattostr(form1.tablegrid1.dbitemid));
form1.label1.caption := floattostr(vclaimno) + ' £ (' + floattostr(vbar)+ '%)';
end;
Problem is, I don't know yet how to get a percentage with decimals in Delphi so all percentages are rounded hence the 0% for the guy who only has 4,99£ because the true result is 0,14% due to this line where I cannot get an extended value for the panel2.width
form1.panel2.width := form1.panel2.width + (vbar * 4);
Edit:
I could get a percentage with decimals using this :
var vbar: currency; //instead of var bar: int;
form1.panel2.width := form1.panel2.width + round(vbar * 4);
But, I don't know how to limit the number of decimals to 2 only for the percentage .