mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
display appoinments where quota not reached and questionnaires and samples enabled, display sample name
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php /**
|
||||
<?php
|
||||
/**
|
||||
* Display appointments
|
||||
*/
|
||||
|
||||
@@ -289,45 +290,53 @@ if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(isset($_GET[
|
||||
else {
|
||||
$operator_id = get_operator_id();
|
||||
$subtitle = T_("Appointments");
|
||||
xhtml_head(T_("Display Appointments"),true,$css,$js_head,false,30); //array("../css/table.css")
|
||||
xhtml_head(T_("Display Appointments"),true,$css,$js_head,false,30);
|
||||
print "<h3>" . T_("All appointments (with times displayed in your time zone)") . "</h3>";
|
||||
|
||||
$sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end,CONCAT(r.firstName, ' ', r.lastName) as resp, IFNULL(ou.description,'" . TQ_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName,
|
||||
$sql = "SELECT q.description, si.description as smpl, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end,CONCAT(r.firstName, ' ', r.lastName) as resp, IFNULL(ou.description,'" . TQ_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName,
|
||||
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
|
||||
CONCAT(' <a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '&delete=delete\' ></i></a> ') as link,
|
||||
CONCAT(' <a href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a> ') as edit,IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho
|
||||
FROM appointment as a
|
||||
JOIN (`case` as c, respondent as r, questionnaire as q, operator as oo, call_attempt as cc) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id)
|
||||
JOIN (`case` as c, respondent as r, questionnaire as q, operator as oo, call_attempt as cc, `sample` as s, sample_import as si) on (c.sample_id = s.sample_id and a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id and si.sample_import_id = s.import_id)
|
||||
LEFT JOIN (`call` as ca, outcome as ou, operator as ooo) ON (ca.call_id = a.completed_call_id and ou.outcome_id = ca.outcome_id and ca.operator_id = ooo.operator_id)
|
||||
LEFT JOIN operator AS ao ON ao.operator_id = a.require_operator_id
|
||||
WHERE a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id !=10
|
||||
LEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)
|
||||
LEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id and c.questionnaire_id = qsqr.questionnaire_id)
|
||||
WHERE q.enabled=1 AND si.enabled=1 AND a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id !=10
|
||||
AND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1)
|
||||
AND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)
|
||||
ORDER BY a.start ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
if (!empty($rs)) {
|
||||
translate_array($rs,array("outcome"));
|
||||
xhtml_table($rs,array("description","case_id","start","end","edit","makerName","witho","resp","outcome","callerName","link"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End")," <i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i> ",T_("Created by"),T_("Appointment with"),T_("Respondent"),T_("Current outcome"),T_("Operator who called")," <i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i> "),"tclass",false,false,"bs-table");
|
||||
xhtml_table($rs,array("description","smpl","case_id","start","end","edit","makerName","witho","resp","outcome","callerName","link"),array(T_("Questionnaire"),T_("Sample"),T_("Case ID"),T_("Start"),T_("End")," <i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i> ",T_("Created by"),T_("Appointment with"),T_("Respondent"),T_("Current outcome"),T_("Operator who called")," <i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i> "),"tclass",false,false,"bs-table");
|
||||
|
||||
} else print "<h4 class='well text-info'>" . T_("No future appointments") . "</h4>";
|
||||
|
||||
print "<h3 style='color:red'>" . T_("Missed appointments (with times displayed in your time zone)") . "</h3>";
|
||||
|
||||
$sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end, CONCAT(r.firstName, ' ', r.lastName) as resp,
|
||||
$sql = "SELECT q.description, si.description as smpl, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end, CONCAT(r.firstName, ' ', r.lastName) as resp,
|
||||
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
|
||||
CONCAT(' <a href=\'\'><i class=\'fa fa-trash-o fa-lg text-danger\' toggle=\'confirmation\' data-placement=\'left\' data-href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '&delete=delete\' ></i></a> ') as link,
|
||||
CONCAT(' <a href=\'?case_id=', c.case_id, '&appointment_id=', a.appointment_id, '\'><i class=\'fa fa-pencil-square-o fa-lg\' ></i></a> ') as edit
|
||||
FROM appointment as a
|
||||
JOIN (`case` as c, respondent as r, questionnaire as q, `sample` as s, sample_import as si) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and s.sample_id = c.sample_id and s.import_id= si.sample_import_id)
|
||||
LEFT JOIN (`call` as ca) ON (ca.call_id = a.completed_call_id)
|
||||
WHERE q.enabled=1 AND si.enabled = 1 AND a.end < CONVERT_TZ(NOW(),'System','UTC') AND a.completed_call_id IS NULL AND c.current_outcome_id !=10
|
||||
LEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)
|
||||
LEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id and c.questionnaire_id = qsqr.questionnaire_id)
|
||||
WHERE q.enabled=1 AND si.enabled=1 AND a.end < CONVERT_TZ(NOW(),'System','UTC') AND a.completed_call_id IS NULL AND c.current_outcome_id !=10
|
||||
AND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1 )
|
||||
AND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)
|
||||
GROUP BY c.case_id
|
||||
ORDER BY a.start ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
if (!empty($rs)) {
|
||||
xhtml_table($rs,array("description","case_id","start","end","edit","resp","link"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End")," <i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i> ",T_("Respondent")," <i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i> "),"tclass",false,false,"bs-table");
|
||||
xhtml_table($rs,array("description","smpl","case_id","start","end","edit","resp","link"),array(T_("Questionnaire"),T_("Sample"),T_("Case ID"),T_("Start"),T_("End")," <i class='fa fa-pencil-square-o fa-lg' data-toggle='tooltip' title='" . T_("Edit") . "'></i> ",T_("Respondent")," <i class='fa fa-trash-o fa-lg' data-toggle='tooltip' title='" . T_("Delete") . "'></i> "),"tclass",false,false,"bs-table");
|
||||
|
||||
} else print "<h4 class='well text-info'>" . T_("No appointments missed") . "</h4>";
|
||||
} else print "<h4 class='well text-info'>" . T_("No missed appointments") . "</h4>";
|
||||
|
||||
}
|
||||
xhtml_foot($js_foot);
|
||||
|
||||
Reference in New Issue
Block a user