<?php
/*
<LICENSE>
This file is part of CHASERS.
CHASERS is Copyright (c) 2003-2008 Downtown Emergency Service Center (DESC).
All rights reserved.
For more information, about DESC, see http://www.desc.org/.
For more information about CHASERS, see http://chasers.desc.org/.
CHASERS is free software: you can redistribute it and/or modify
it under the terms of version 3 of the GNU General Public License
as published by the Free Software Foundation.
CHASERS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CHASERS. If not, see <http://www.gnu.org/licenses/>.
</LICENSE>
*/
$quiet="Y";
include "includes.php";
include "openoffice.php";
include "zipclass.php";
$sdate=$_REQUEST["sdate"];
$edate=$_REQUEST["edate"];
$template = CG_TEMPLATE_DIRECTORY.'/rpt_dropin.sxw';
$out .=
formto()
. oline("Enter Start Date" . formdate("sdate",$sdate))
. oline("Enter End Date" . formdate("edate",$edate))
. button()
. formend();
if ($sdate || $edate)
{
if (! ($sdate && $edate))
{
$out.=alert_mark("Both Start & End Date Required");
}
else
{
$range = new date_range($sdate,$edate);
$sql="SELECT case_id,
name_full AS client_name,
dal_date,
description,
tot_min,
cmgrfirst || ' ' || cmgrlast AS cmgr_name
FROM clin_dal
LEFT JOIN clin_l_dal USING (dal_code)
LEFT JOIN clin_client USING (case_id)
LEFT JOIN clin_staff ON (curr_cm_id=cmgrid)
LEFT JOIN client ON (case_id=clinical_id)";
$filter["BETWEEN:dal_date"]=$range;
$filter["dal_code"]=618;
$order = "cmgr_name,client_name,dal_date";
//$query_display="Y";
$data=sql_query("SET DATESTYLE TO SQL"); // don't care about result
$data=desc_query($sql,$filter,$order);
$file=oowriter_merge($data,$template,"","","client_name");
office_mime_header("writer");
out($file->data());
page_close($silent=true); //no footer on oo files
exit;
}
}
$title= "Dal Drop-in Report";
$out = oline(bigger(bold($title))) . $out;
chasers_top_header();
out($out);
page_close();
?>