📄 reports.php
字号:
<?php
// +-------------------------------------------------------------+
// | DeskPRO v [2.0.1 Production]
// | Copyright (C) 2001 - 2004 Headstart Solutions Limited
// | Supplied by WTN-WDYL
// | Nullified by WTN-WDYL
// | Distribution via WebForum, ForumRU and associated file dumps
// +-------------------------------------------------------------+
// | DESKPRO IS NOT FREE SOFTWARE
// +-------------------------------------------------------------+
// | License ID : Full Enterprise License =) ...
// | License Owner : WTN-WDYL Team
// +-------------------------------------------------------------+
// | $RCSfile: reports.php,v $
// | $Date: 2004/02/10 01:34:25 $
// | $Revision: 1.61 $
// +-------------------------------------------------------------+
// | File Details:
// | - Report and statistic maintenance and launcher (administration
// | interface)
// +-------------------------------------------------------------+
error_reporting(E_ALL & ~E_NOTICE);
require_once('./global.php');
//Nullify WTN-WDYL Team
feature_check('reports');
// default do
$_REQUEST['do'] = trim($_REQUEST['do']);
if (!isset($_REQUEST['do']) or $_REQUEST['do'] == "") {
$_REQUEST['do'] = "listreports";
}
// globalise variables
$global = array (
array('id', 'number')
);
rg($global);
############################### LIST REPORTS ###############################
if ($_REQUEST['do'] == "viewreports") {
admin_header('Reports', 'View Reports');
$db->query("SELECT id, title FROM report_stat");
while ($result = $db->row_array()) {
$stat[$result[id]] = $result[title];
}
$db->query("SELECT * FROM report_relations");
while ($result = $db->row_array()) {
$relations[$result[reportid]][] = $stat[$result[statid]];
}
$db->query("SELECT * FROM report");
while ($result = $db->row_array()) {
$table[] = array(
"<form method=\"post\" action=\"runreport.php\"><b>$result[name]</b>",
'Start on ' . form_date('date', '', '', '', '', date('Y-m-d', strtotime(date('Y-m-01') . '-1 month'))).
' and report for ' .
form_input('number',
1,
4)
. form_select('type',
array('days' => 'day(s)',
'months' => 'month(s)',
'years' => 'year(s)'),
'',
'months')
. form_hidden('id', $result[id])
. "<input type=\"submit\" name=\"Run\" value=\"Run\"></form>",
"<a href=\"reports.php?do=editreport&id=$result[id]\">View / Edit Report",
jprompt('Are you sure you want to delete this report?',
"reports.php?do=deletereport&id=$result[id]", 'Delete')
);
}
$cols = array('Report Title', 'Specify Date Range', 'View/Edit Report', 'Delete');
table_header('Reports', 'runreport.php');
table_content($cols, $table);
table_footer();
}
############################### DELETE REPORT ###############################
if ($_REQUEST['do'] == "deletereport") {
$db->query("DELETE FROM report WHERE id = '$id'");
$db->query("DELETE FROM report_relations WHERE reportid = '$id'");
jump('reports.php?do=viewreports', 'Report Deleted');
}
############################### DELETE STAT ###############################
if ($_REQUEST['do'] == "deletestat") {
$db->query("DELETE FROM report_stat WHERE id = '$id'");
jump('reports.php?do=viewstats', 'Statistic Deleted');
}
############################### LIST STATS ###############################
if ($_REQUEST['do'] == "viewstats") {
admin_header('Reports', 'View Stats');
$db->query("SELECT id, title, description FROM report_stat");
while ($result = $db->row_array()) {
$table[] = array(
$result[title],
$result[description],
"<a href=\"reports.php?do=editstat&id=$result[id]\">View / Edit Statistic</A>",
"<a href=\"runreport.php?do=previewstat&id=$result[id]\">Preview</A>",
jprompt('Are you sure you want to delete this statistic?', "reports.php?do=deletestat&id=$result[id]", 'Delete')
);
}
$cols = array('Statistic Title', 'Statistic Description', 'View/Edit Statistic', 'Preview', 'Delete');
table_header('Reports');
table_content($cols, $table);
table_footer();
}
############################### EDIT / NEW REPORT ###############################
if ($_REQUEST['do'] == "editreport" OR $_REQUEST['do'] == "newreport") {
if ($_REQUEST['do'] == 'newreport') {
admin_header('Reports', 'New Report');
} else {
admin_header('Reports', 'Edit Report');
}
$report = $db->query_return("SELECT * FROM report WHERE id = '$id'");
echo get_javascript('selectBox.js');
$table[] = array('<b>Report Name</b><BR>
This report\'s short (display) name.',
form_input('name', $report[name])
);
$table[] = array('<b>Report Title</b><br />
This report\'s printed name (shown on the generated report)',
form_input('title', $report[title])
);
$table[] = array('<b>Report Description</b><br />
This report\'s detailed description (shown on the generated report)',
form_textarea('description', 60, 5, $report[description])
);
$db->query("SELECT name, id FROM report_style");
while ($result = $db->row_array()) {
$styles[$result[id]] = $result[name];
}
$table[] = array('<b>Report Style</b><BR>
Select the desired style to apply to this report.',
form_select('style', $styles, '', $report[style])
);
$table[] = array('<b>E-mail Report</b><br />
[Optional] Comma-separated list of addresses to e-mail a copy of the
generated report to.',
form_textarea('email', 60, 6, $report[email])
);
give_default($report[path], '');
$table[] = array('<b>Save Report</b><br />
[Optional] Save a copy of the generated report as ...
<I>(this requires write access to the given directory)</I>',
form_input('path', $report[path])
);
$table[] = array('<b>Report Format</b><BR>
Select the desired reporting format.',
form_select('format', array('HTML' => 'HTML', 'PDF' => 'PDF'),
'',
$report[format])
);
$month = array('1' => 'Jan',
'2' => 'Feb',
'3' => 'Mar',
'4' => 'Apr',
'5' => 'May',
'6' => 'Jun',
'7' => 'Jul',
'8' => 'Aug',
'9' => 'Sep',
'10' => 'Oct',
'11' => 'Nov',
'12' => 'Dec'
);
$table[] = table_midheader('Statistics to Use');
$reportarray = array();
if ($_REQUEST['do'] == "editreport") {
$db->query("SELECT report_stat.id, report_stat.title
FROM report_relations
LEFT JOIN report_stat ON (report_stat.id = report_relations.statid)
WHERE reportid = '$id'
");
while ($result = $db->row_array()) {
$reportarray[] = $result[id];
$html2 .= "<option value=\"$result[id]\">$result[title]</option>";
}
}
$db->query("SELECT id, title FROM report_stat");
while ($result = $db->row_array()) {
if (!in_array($result[id], $reportarray)) {
$html .= "<option value=\"$result[id]\">$result[title]</option>";
}
}
$table[] = array("<b>Select Statistics</b><BR>
Select which statistics should be included in this report. Note that
each statistic will generate its own data table or graph <I>(Note:
CSV-format statistics cannot be mixed with other formats. Only one
CSV-format statistic can be specified a single report (and it must be
the only statistic in the report.).</I>", "
<TABLE BORDER=0>
<TR>
<TD VALIGN=MIDDLE ALIGN=CENTER>
<b>Available Statistics</b><br />
<SELECT style=\"width:200px\" NAME=\"list11\" MULTIPLE SIZE=10 onDblClick=\"moveSelectedOptions(this.form.list11,this.form.list21,false)\">
$html
</SELECT>
</TD>
<td> </td>
<TD VALIGN=MIDDLE ALIGN=CENTER>
<INPUT TYPE=\"button\" NAME=\"right\" VALUE=\"Add >>\" onClick=\"moveSelectedOptions(document.forms[0].list11,document.forms[0].list21,false);return false;\"><BR><BR>
<INPUT TYPE=\"button\" NAME=\"right\" VALUE=\"Add All >>\" onClick=\"moveAllOptions(document.forms[0].list11,document.forms[0].list21,false); return false;\"><BR><BR>
<INPUT TYPE=\"button\" NAME=\"left\" VALUE=\"<< Delete\" onClick=\"moveSelectedOptions(document.forms[0].list21,document.forms[0].list11,false); return false;\"><BR><BR>
<INPUT TYPE=\"button\" NAME=\"left\" VALUE=\"<< Delete All\" onClick=\"moveAllOptions(document.forms[0].list21,document.forms[0].list11,false); return false;\">
</TD>
<td> </td>
<TD VALIGN=MIDDLE ALIGN=CENTER>
<b>Selected Statistics</b><br />
<SELECT style=\"width:200px\" NAME=\"list21\" MULTIPLE SIZE=10 onDblClick=\"moveSelectedOptions(this.form.list21,this.form.list11,false)\">
$html2
</SELECT>
</TD>
<td> </td>
<TD ALIGN=\"CENTER\" VALIGN=\"MIDDLE\">
<b>Move Selected Statistic</b><br />
<input type=\"hidden\" name=\"stats\">
<INPUT TYPE=\"button\" VALUE=\" Up \" onClick=\"moveOptionUp(this.form.list21)\">
<INPUT TYPE=\"button\" VALUE=\"Down\" onClick=\"moveOptionDown(this.form.list21)\">
</TD>
</TR>
</TABLE>");
$table[] = table_midheader('Repetition Options');
if (!$report[repeattype]) {
$table[] = array('<b>No Repeat</b>',
"<input type=\"radio\" name=\"type\" value=\"0\" checked=checked> Don't run this report automatically "
);
} else {
$table[] = array('<b>Daily Repeat</b>',
"<input type=\"radio\" name=\"type\" value=\"0\"> Don't run this report automatically "
);
}
if ($report[repeattype] == 1) {
$table[] = array('<b>Daily Repeat</b>',
"<input type=\"radio\" name=\"type\" value=\"1\" checked=checked> Run this report every "
. form_input('type1_day', $report[value1], 1) . " day(s)<br />"
);
} else {
$table[] = array('<b>Daily Repeat</b>',
"<input type=\"radio\" name=\"type\" value=\"1\"> Run this report every "
. form_input('type1_day', '', 1) . " day(s)<br />"
);
}
if ($report[repeattype] == 2) {
$days = unserialize($report[value2]);
$table[] = array('<b>Weekly Repeat</b>',
"<input type=\"radio\" name=\"type\" value=\"2\" checked=checked>
Run this report every "
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -