Created
January 17, 2017 08:19
-
-
Save anonymous/38b0a0c17a55af85be158d120be39e17 to your computer and use it in GitHub Desktop.
TASK №1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var | |
... | |
begin | |
... | |
Log.First(); | |
k = 0; | |
// Цикл по записям лога | |
while not Log.EOF() do | |
begin | |
// Если текущую работу выполнил наш пользователь | |
if Log.Fields("UserName") = User.Name then | |
begin | |
// Добавим к переменной HoursWorked длительность текущей работы | |
HoursWorked := HoursWorked + Log.Fields("Duration"); | |
inc(k); | |
end; | |
// Перейдем к следующей записи лога | |
Log.Next(); | |
end; | |
// Переведем общую длительность работ из минут в часы | |
HoursWorked := HoursWorked / 60; | |
// Вычислим среднюю длительность работ | |
Avg := HoursWorked / k; | |
// Зададим свойства отчета | |
Report.Fields("UserField1") := User.Name; | |
Report.Fields("UserField2") := FloatToStr(HoursWorked) + " (" + | |
FloatToStr(Avg) + " ч./работу)"; | |
Report.Fields("Title") := "Отчет по отработанному времени"; | |
Report.Fields("ViewScale") := "80%"; | |
Report.Fields("LeftMargin") := "2см"; | |
Report.Fields("RightMargin") := "1см"; | |
Report.Fields("TopMargin") := "1см"; | |
Report.Fields("BottomMargin") := "1см"; | |
... | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Имена
UserField1
иUserField2
не отражают суть полей. Предлагаю использоватьUserName
иAverageWorkHours
вместо них.