Código
begin
decodedate(DataIni,anoi,mesi,diai);
decodedate(DataFim,anof,mesf,diaf);
tot1 := diai + mesi * 30 + anoi * 360;
tot2 := diaf + mesf * 30 + anof * 360;
tot3 := tot2 - tot1 + 1;
pano := tot3 / 360;
pmes := ( tot3 mod 360 ) / 30;
pdia := ( tot3 mod 360 ) mod 30 / 1;
if tipo = 'Comum' then
Result := FloatToStr(trunc(TOT3))
else
Result := FloatToStr(trunc(TOT3));
end;
Function Calculapercentual(DataIni, DataFim : TDateTime;sexo :String) : String;
var data1 :TDateTime;
anoi,mesi,diai :word;
anof,mesf,diaf :word;
tot1,tot2,tot3 :Integer;
pdia,pmes,pano,v_resto,tot4 :Extended;
begin
decodedate(DataIni,anoi,mesi,diai);
decodedate(DataFim,anof,mesf,diaf);
tot1 := diai + mesi * 30 + anoi * 360;
tot2 := diaf + mesf * 30 + anof * 360;
tot3 := tot2 - tot1 + 1;
if sexo = 'M' then
begin
tot4 := tot3 * ( 40 / 100 );
end
else
tot4 := tot3 * ( 20 / 100 );
Result := floattostr(trunc(tot4));
end;
Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009