<html>

<script type="text/dlbscript">// Inline script gets removed after build

function GetDurationM: String;
var
  S, F: TDateTime;
  m: Integer;
begin 
  S := XMLToDateTime(<rec."start">);
  F := XMLToDateTime(<rec."finish">);
  
  if (TimeOf(S) = 0) and (TimeOf(F) = 0) then
    Result := ScriptingHost.MainInterface.GetTranslator.Get_Text('IDS_WHOLEDAY')
  else
  begin
    m := Round(MinuteSpan(S, F));
    
    if m < 60 then
      Result := IntToStr(m) + ' min'
    else
    begin
      Result := IntToStr(Trunc(m / 60)) + ' h';
      m := m - (Trunc(m / 60) * 60); 
      if m > 0 then
        Result := Result + ' ' + IntToStr(m) + ' min'
    end;
  end;
end;

function GetDisplayText: String;
var
  S, F: TDateTime;
begin 
  S := XMLToDateTime(<rec."start">);
  F := XMLToDateTime(<rec."finish">);
  
  if (TimeOf(S) = 0) and (TimeOf(F) = 0) then
    Result := ScriptingHost.MainInterface.GetTranslator.Get_Text('IDS_WHOLEDAY')
  else  
    Result := IntToStr(Round(MinuteSpan(S, F))) + ' min';
end;

//</script>

<report-objects>
  <object name="rec" sql="select start,finish FROM recordset WHERE id = :EditValue" type=""></object>
</report-objects>

<body style="background-color: transparent;">

<div class="delight-dynamicblock" style="min-height: 0.0em; display: flex;">

{{#rec}}
<div style="padding-left: 0.0em">
	{{START(hh:mm)}} - {{FINISH(hh:mm)}} 
</div>

<div style="text-align: right; flex-grow: 1;">
  {{#script}}GetDurationM{{/script}}
</div>

{{/rec}}

</div>

</body>

</html>
