Software Freedom Law Center

root/trunk/antimatter/tim/Scripts/weekly-emp-time-report.plx

Revision 53, 2.6 kB (checked in by bkuhn, 9 months ago)
  • Added SFLC's internally developed tim bot released under AGPLv3
  • Property svn:executable set to
Line 
1 use strict;
2 use warnings;
3
4 use  SFLC::TimeTracker::Entry;
5 use  SFLC::TimeTracker::DB;
6 use SFLC::TimeTracker::Question;
7 use SFLC::TimeTracker::Input;
8 use SFLC::TimeTracker::Category;
9 use SFLC::TimeTracker::Reports;
10 use POSIX;
11
12 use Date::Manip;
13
14 my    $DATABASE =
15       new SFLC::TimeTracker::DB("MLDBM", "/home/ircbot/TimeDB/time-data.mldbm",
16                                     "/home/ircbot/TimeDB/pending-time.mldbm");
17
18     SFLC::TimeTracker::Entry::Initialize($DATABASE);
19     SFLC::TimeTracker::Question::Initialize($DATABASE);
20     SFLC::TimeTracker::Input::Initialize($DATABASE);
21
22
23
24     SFLC::TimeTracker::Entry::Initialize($DATABASE);
25
26 my $startDate = ParseDate("1 week ago Monday at 00:00");
27 my $endDate = ParseDate("last Sunday at 23:59");
28
29 my $today = ParseDate("today");
30
31 my(@users) = $DATABASE->getUserList();
32 foreach my $user (@users) {
33   SFLC::TimeTracker::Reports::Detail($DATABASE, $user, $startDate, $endDate,
34                                   'ALL', 'ALL', "$user\@example.org",
35                                     <<STUFF
36 Please verify that this report is correct.  On Wednesday morning, the hours
37 become official.
38
39 STUFF
40 );
41   SFLC::TimeTracker::Reports::QuickSummary($DATABASE, $user,
42                                            $startDate, $endDate,
43                                            0, 1,
44              ParseDate(POSIX::strftime("%a,  %d  %b  %Y  %H:%M:%S  %z",
45                                    localtime)), undef, 0);
46
47   my $firstDayYear = ParseDate(UnixDate($startDate, "1 January %Y"));
48
49   SFLC::TimeTracker::Reports::Summary($DATABASE, $user,
50                                     $firstDayYear, $endDate,
51       'admin', '(?:personal|vacation|holiday|sick)', "$user\@example.org",
52                                     <<STUFF
53                                Time-Off/Sick Report
54
55 STUFF
56 );
57
58
59 # If last Sunday was in the same month as today, but not the same month
60 # as the start date, then run the monthlies
61   if (UnixDate($endDate, '%B') eq UnixDate($today, '%B') and
62       UnixDate($startDate, '%B') ne UnixDate($today, '%B')) {
63     my $lastMonth = ParseDate("last month");
64
65     my $lastDayLastMonth = ParseDate(UnixDate($lastMonth,
66                                               "last day of %B %Y at 23:59:59"));
67     my $firstDateLastMonth = ParseDate(UnixDate($lastMonth, "1 %B %Y"));
68
69     SFLC::TimeTracker::Reports::Vacation($DATABASE, $user, $lastDayLastMonth,
70                                          "$user\@example.org", undef);
71
72   }
73 }
74 ###############################################################################
75 #
76 # Local variables:
77 # compile-command: "perl -I ../Modules -c weekly-emp-time-report.plx"
78 # End:
79
Note: See TracBrowser for help on using the browser.

SFLC Main Page

[frdm] Support SFLC