コード例 #1
0
ファイル: tablemanage_inc.php プロジェクト: nicost/phplabware
/**
 * *
 *  return a single entry for a report
 *
 */
function test_report($db, $offset, $tablename)
{
    global $_POST, $_GET, $system_settings;
    $_GET['tablename'] = $tablename;
    $tableinfo = new tableinfo($db);
    $real_tablename = get_cell($db, "tableoftables", "real_tablename", "tablename", $tablename);
    $reportid = $_POST["report_id"][$offset];
    $r = $db->Execute("SELECT * FROM {$real_tablename}");
    $fields = comma_array_SQL($db, $tableinfo->desname, "columnname");
    $Allfields = getvalues($db, $tableinfo, $fields, "id", $r->fields["id"]);
    $tp = @fopen($system_settings["templatedir"] . "/{$reportid}.tpl", "r");
    if ($tp) {
        while (!feof($tp)) {
            $template .= fgets($tp, 64000);
        }
        fclose($tp);
    }
    require './includes/report_inc.php';
    $report = make_report($db, $template, $Allfields, $tableinfo, 1);
    return $report;
}
コード例 #2
0
ファイル: report.php プロジェクト: nicost/phplabware
            if ($reportid > 0) {
                echo make_report($db, $template, $Allfields, $tableinfo, $USER['settings']['reportoutput'], $counter);
            } elseif ($reportid == -1) {
                echo make_xml($db, $Allfields, $tableinfo);
            } elseif ($reportid == -2) {
                echo make_sheet($db, $Allfields, $tableinfo, $USER['settings']['reportoutput'], $Fieldscomma, "\t", false);
            } elseif ($reportid == -3) {
                echo make_sheet($db, $Allfields, $tableinfo, $USER['settings']['reportoutput'], $Fieldscomma, ',', false);
            }
            $r->MoveNext();
            $counter++;
        }
        if ($reportid > 0) {
            foreach ($Allfields as $column) {
                if ($column['name']) {
                    //$sums is defined as global in function make_reports.  It sums whatever it finds while looping through the records it displays. All occurences of '&fieldname' in the footer will be replaced with the sum of the rows.
                    $footer = str_replace("&" . $column['name'], $sums[$column['name']], $footer);
                }
            }
            echo $footer;
        } elseif ($reportid == -1) {
            echo '</' . "phplabware_base>\n>";
        }
    }
} else {
    // just a single record
    $fields = comma_array_SQL($db, $tableinfo->desname, 'columnname');
    $Allfields = getvalues($db, $tableinfo, $fields, 'id', $recordid);
    $report = make_report($db, $template, $Allfields, $tableinfo);
    echo $report;
}