- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
if ($_REQUEST["date_type"] == 1) {
$filter .= "AND t.id IN (SELECT task_id FROM `task_comments` WHERE (`status_id`=".$DB->F($doneStatus["id"])." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')>=".$DB->F(date("Y-m-d", strtotime($_POST['datefrom'])))." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')<=".$DB->F(date("Y-m-d", strtotime($_POST['dateto']))).") ORDER BY `datetime` DESC) AND t.id NOT IN (SELECT task_id FROM `task_comments` WHERE (`status_id`=".$DB->F($doneStatus["id"])." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')>".$DB->F(date("Y-m-d", strtotime($_POST['dateto']))).") ORDER BY `datetime` DESC)";
} else {
if ($_REQUEST["date_type"] == 2) {
$filter .= "AND t.id IN (SELECT task_id FROM `task_comments` WHERE `status_id` AND (DATE_FORMAT(`datetime`, '%Y-%m-%d')>=".$DB->F(date("Y-m-d", strtotime($_POST['datefrom'])))." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')<=".$DB->F(date("Y-m-d", strtotime($_POST['dateto'])))."))";
} else {
if ($_REQUEST["date_type"] == 3) {
$filter .= "AND t.id IN (SELECT task_id FROM `task_comments` WHERE ((`status_id`=".$DB->F($doneStatus["id"])." OR `status_id`=".$DB->F($failStatus["id"])." OR `status_id`=".$DB->F($failOpStatus["id"]).") AND DATE_FORMAT(`datetime`, '%Y-%m-%d')>=".$DB->F(date("Y-m-d", strtotime($_POST['datefrom'])))." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')<=".$DB->F(date("Y-m-d", strtotime($_POST['dateto']))).") ORDER BY `datetime` DESC) AND t.id NOT IN (SELECT task_id FROM `task_comments` WHERE ((`status_id`=".$DB->F($doneStatus["id"])." OR `status_id`=".$DB->F($failStatus["id"])." OR `status_id`=".$DB->F($failOpStatus["id"]).") AND DATE_FORMAT(`datetime`, '%Y-%m-%d')>".$DB->F(date("Y-m-d", strtotime($_POST['dateto']))).") ORDER BY `datetime` DESC)";
} else {
if ($_REQUEST["date_type"] == 4) {
// am
$filter .= "AND tick.inmoney=1 AND DATE_FORMAT(tick.inmoneydate, '%Y-%m-%d')>=".$DB->F(date("Y-m-d", strtotime($_POST['datefrom']))) . " AND DATE_FORMAT(tick.inmoneydate, '%Y-%m-%d')<=".$DB->F(date("Y-m-d", strtotime($_POST['dateto'])));
} else {
if ($_REQUEST["date_type"] == 5) {
//cl_date
$filter .= "AND t.id IN (SELECT task_id FROM `task_comments` WHERE (`status_id`=".$DB->F($closedStatus["id"])." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')>=".$DB->F(date("Y-m-d", strtotime($_POST['datefrom'])))." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')<=".$DB->F(date("Y-m-d", strtotime($_POST['dateto']))).") ORDER BY `datetime` DESC) AND t.id NOT IN (SELECT task_id FROM `task_comments` WHERE (`status_id`=".$DB->F($closedStatus["id"])." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')>".$DB->F(date("Y-m-d", strtotime($_POST['dateto']))).") ORDER BY `datetime` DESC)";
} else {
if ($_REQUEST["date_type"] == 6) {
//rep_date
$filter .= "AND t.id IN (SELECT task_id FROM `task_comments` WHERE (`status_id`=".$DB->F($reportStatus["id"])." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')>=".$DB->F(date("Y-m-d", strtotime($_POST['datefrom'])))." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')<=".$DB->F(date("Y-m-d", strtotime($_POST['dateto']))).") ORDER BY `datetime` DESC)";
} else {
if ($_REQUEST["date_type"] == 7) {
//rep_date
$filter .= "AND t.id IN (SELECT task_id FROM `task_comments` WHERE (`status_id`=".$DB->F($accStatus["id"])." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')>=".$DB->F(date("Y-m-d", strtotime($_POST['datefrom'])))." AND DATE_FORMAT(`datetime`, '%Y-%m-%d')<=".$DB->F(date("Y-m-d", strtotime($_POST['dateto']))).") ORDER BY `datetime` DESC)";
} else {
$filter .= " AND DATE_FORMAT(t.date_reg, '%Y-%m-%d')>=".$DB->F(date("Y-m-d", strtotime($_POST['datefrom']))) . " AND DATE_FORMAT(t.date_reg, '%Y-%m-%d')<=".$DB->F(date("Y-m-d", strtotime($_POST['dateto'])));
}
}
}
}
}
}
}