From 6f2e6899cc404f314648782920e343c8529885d3 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Sun, 11 Apr 2010 20:54:06 +0300 Subject: First commit --- public/month.php | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 public/month.php (limited to 'public/month.php') diff --git a/public/month.php b/public/month.php new file mode 100644 index 0000000..a3cd47e --- /dev/null +++ b/public/month.php @@ -0,0 +1,58 @@ +prepare($sql); + + // Get total hours for each day + $sql = "SELECT strftime('%s', finish) - strftime('%s', start) AS done + FROM atwork + WHERE user = ? + AND date(finish) = ?"; + + $stmt = $db->prepare($sql); + + if (!$_POST['m']) { + $_SESSION['m'] = date('n'); + } + + $_SESSION['m'] = $_SESSION['m'] + $_POST['m']; + $month = sprintf('%02d', $_SESSION['m']); + $stmt_tot->execute(array($_SESSION['user'], $month)); + $total = current($stmt_tot->fetchAll()); + $first = mktime(0, 0, 0, $_SESSION['m'], 0); + $last = mktime(0, 0, 0, $_SESSION['m']+1, 0); + $days = ($last-$first)/3600/24; + +?> + + +

(h)

+ +execute(array($_SESSION['user'], date('Y-m-d', $current))); + $tmp = current($stmt->fetchAll()); + $work = $tmp['done']/3600; + +?> + +
+ +
h
+
+ + -- cgit v1.2.3