- Add an option to view reports from previous years

This commit is contained in:
dave 2007-10-20 04:04:14 +00:00
parent 40067ed0c4
commit 186c0525b7
3 changed files with 6 additions and 2 deletions

View File

@ -349,10 +349,11 @@ foreach($stock as $n=>$v) {
function report_gen_by_id($report_id, $format=NULL)
function report_gen_by_id($report_id, $year, $format=NULL)
{
global $options;
$report = report_load($report_id);
$report['year'] = $year;
if($format != NULL) {
$keys = array_keys($options['type']['values']);
if(in_array($format, $keys)) {

View File

@ -44,6 +44,7 @@
echo "<select name=\"type\"><option value=\"\">Default Format</option>";
echo "<option value=\"pdf\">PDF</option>";
echo "<option value=\"csv\">CSV</option></select>";
echo "<input type=\"text\" value=\"{$config['FAIRYEAR']}\" size=\"5\" name=\"year\" />";
echo "<input type=\"submit\" value=\"Generate Report\"></form>";
echo "<br />";
echo "<hr />";

View File

@ -30,9 +30,11 @@
$id = intval($_GET['id']);
$format = stripslashes($_GET['type']);
$year = intval($_GET['year']);
if($year < 1000) $year = $config['FAIRYEAR'];
if($format == '') $format = NULL;
report_gen_by_id($id, $format);
report_gen_by_id($id, $year, $format);
?>