gtd-php
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 08, 2010, 10:02:17 PM

Login with username, password and session length
Search:     Advanced search
1756 Posts in 305 Topics by 422 Members
Latest Member: jong21
* Home Help Search Calendar Login Register
+  gtd-php
|-+  gtd-php
| |-+  gtd-php users
| | |-+  Displaying all the items completed at a specific date
« previous next »
Pages: [1] Print
Author Topic: Displaying all the items completed at a specific date  (Read 219 times)
mouflon
Jr. Member
**
Posts: 7


View Profile
« on: April 15, 2010, 01:55:37 AM »

Morning,

Is there any way to display all the items completed at a specific date?
Congratulations for your really good work ! Thanks for your help.

Regards.
 
Logged
Andrew
Administrator
Hero Member
*****
Posts: 375


View Profile
« Reply #1 on: April 15, 2010, 02:15:10 AM »

Welcome back!

The answer to your question is: Almost.

You can display all completed items by using Process > Quick find, untick "show all", tick "show completed", set "status of parent" to "any", then press "filter". You'll get a list of all items ever completed. This may be huge! Now click on the "Date Completed" column header, and it will sort all the items by the completion date.

Let's say you had 50 completed items, and 30 of them had been completed before 1 January 2010 - then those will be the top 30 items in the list.

Hope this helps,
Andrew

« Last Edit: April 15, 2010, 02:44:34 AM by Andrew » Logged
mouflon
Jr. Member
**
Posts: 7


View Profile
« Reply #2 on: April 15, 2010, 03:54:37 PM »

Thanks Andrew.

That's the way I have tried to do it but it is not really efficient  ne easy to know exactly what has been completed on a specific day...
How difficult is it to develop a script similar to the "quick find" box?

Thanks for your help.

Logged
Andrew
Administrator
Hero Member
*****
Posts: 375


View Profile
« Reply #3 on: April 16, 2010, 12:51:39 AM »

Quote
How difficult is it to develop a script similar to the "quick find" box?

Fairly easy. Take the standard getitemsandparent query, and add a custom filter to it. Something like this:
Code:
<?php
$date
='2010-04-14'// Note the YYYY-MM-DD format
$values=array('filterquery' => '''extravarsfilterquery' => '');
$values['childfilterquery'] = " WHERE its.`dateCompleted`='$date' ";
$maintable=query('getitemsandparent'$values);
?>

<table class='datatable sortable'>
<?php require 'displayItems.inc.php'?>
</table>

HTH,
Andrew
Logged
mouflon
Jr. Member
**
Posts: 7


View Profile
« Reply #4 on: April 16, 2010, 08:43:11 AM »

Sorry Andrew but I do not know where I should paste this code...
There is something wrong when I use this code in a dedicated php file: "Call to undefined function query()".
Logged
Andrew
Administrator
Hero Member
*****
Posts: 375


View Profile
« Reply #5 on: April 16, 2010, 11:00:41 AM »

Yes, that was just the core code: you'd need to write a gtd-php addon to host it. It's a day's work or so, but I'm afraid that I don't have time at the moment, sorry.
Logged
mouflon
Jr. Member
**
Posts: 7


View Profile
« Reply #6 on: April 21, 2010, 09:46:01 AM »

This code is not serious at all ... but it works.  So, it's better than nothing while waiting for a more brilliant add-on

File: date.php

<html><body>
<form method="POST" action="DateCompleted.php">
Date: <input type="date" name="search1" size="12"><br>
<input type="submit" value="OK">
</form></body></html>

File DateCompleted.php:

<?php


$search = $_POST['search1'];
$db = mysql_connect('HOP', 'HOP', 'HOP');
mysql_select_db('HOP',$db);
$sql = 'SELECT itemstatus.dateCompleted,itemstatus.itemId,items.title,items.desiredOutcome,lookup.parentId FROM itemstatus,items,lookup
WHERE itemstatus.itemId=items.itemId AND itemstatus.itemId=lookup.itemId AND itemstatus.dateCompleted="'.$search.'"';
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
echo '<TABLE BORDER="1"><CAPTION> Completed items on'.' '.$search.'</CAPTION>';
while($data = mysql_fetch_assoc($req))

    {
$sql2 = 'SELECT items.title FROM items WHERE items.itemId="'.$data['parentId'].'"';
$req2 = mysql_query($sql2) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error()); 
$data2 = mysql_fetch_assoc($req2);

  echo '<TR>
 <TH>';

echo $data2['title'] ;


echo '</TH>
 <TH>';

echo $data['title'] ;


echo '</TH>
 <TH>';

echo $data['desiredOutcome'] ;



echo '</TH>
  </TR>';
   
    }

echo '</TABLE>';
mysql_close();
?>
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!