示例#1
0
$having = isset($_GET['having']) ? $_GET['having'] : "";
$page = isset($_POST['page']) ? $_POST['page'] : "1";
//$sql = "SELECT * FROM ".TB_PREFIX."invoices LIMIT $start, $limit";
$invoice = new invoice();
$invoice->sort = $sort;
if ($auth_session->role_name == 'customer') {
    $invoice->customer = $auth_session->user_id;
} elseif ($auth_session->role_name == 'biller') {
    $invoice->biller = $auth_session->user_id;
}
$invoice->query = isset($_REQUEST['query']) ? $_REQUEST['query'] : null;
$invoice->qtype = isset($_REQUEST['qtype']) ? $_REQUEST['qtype'] : null;
$large_dataset = getDefaultLargeDataset();
if ($large_dataset == $LANG['enabled']) {
    $sth = $invoice->select_all('large', $dir, $rp, $page, $having);
    $sth_count_rows = $invoice->count();
    $invoice_count = $sth_count_rows->fetch(PDO::FETCH_ASSOC);
    $invoice_count = $invoice_count['count'];
} else {
    $sth = $invoice->select_all('', $dir, $rp, $page, $having);
    $sth_count_rows = $invoice->select_all('count', $dir, $rp, $page, $having);
    $invoice_count = $sth_count_rows->rowCount();
}
$invoices = $sth->fetchAll(PDO::FETCH_ASSOC);
$xml = "";
$xml .= "<rows>";
$xml .= "<page>{$page}</page>";
$xml .= "<total>" . $invoice_count . "</total>";
foreach ($invoices as $row) {
    $xml .= "<row id='" . $row['id'] . "'>";
    $xml .= "<cell>\n\t\t\t\t\t<![CDATA[<a class='index_table' title='" . $LANG['quick_view_tooltip'] . " " . $row['preference'] . " " . $row['index_id'] . "' href='index.php?module=invoices&view=quick_view&id=" . $row['id'] . "'> <img src='images/common/view.png' class='action' /></a>\n\t\t<a class='index_table' title='" . $LANG['edit_view_tooltip'] . " " . $row['preference'] . " " . $row['index_id'] . "' href='index.php?module=invoices&view=details&id=" . $row['id'] . "&action=view'><img src='images/common/edit.png' class='action' /></a>\n\t\t<!--2 Print View -->\n\t\t\t<a class='index_table' title='" . $LANG['print_preview_tooltip'] . " " . $row['preference'] . " " . $row['index_id'] . "' href='index.php?module=export&view=invoice&id=" . $row['id'] . "&format=print'>\n\t\t\t\t<img src='images/common/printer.png' class='action' /><!-- print -->\n\t\t\t</a>\n\t\t<!--3 EXPORT DIALOG -->\n\t\t\t<a title='" . $LANG['export_tooltip'] . " " . $row['preference'] . " " . $row['index_id'] . "' class='invoice_export_dialog' href='#' rel='" . $row['id'] . "'>\n\t\t\t\t<img src='images/common/page_white_acrobat.png' class='action' />\n\t\t\t</a>\n\n\t\t<!--3 EXPORT DIALOG  onclick='export_invoice(" . $row['id'] . ", \"" . $config->export->spreadsheet . "\", \"" . $config->export->wordprocessor . "\");'> -->\t\n\t\t<!--3 EXPORT TO PDF <a title='" . $LANG['export_tooltip'] . " " . $row['preference'] . " " . $row['index_id'] . "' class='index_table' href='pdfmaker.php?id=" . $row['id'] . "'><img src='images/common/page_white_acrobat.png' class='action' /></a> -->\n\t\t<!--4 XLS <a title='" . $LANG['export_tooltip'] . " " . $row['preference'] . " " . $row['index_id'] . " " . $LANG['export_xls_tooltip'] . $config->export->spreadsheet . " " . $LANG['format_tooltip'] . "' class='index_table' href='index.php?module=invoices&view=templates/template&invoice='" . $row['id'] . "&action=view&location=print&export=" . $config->export->spreadsheet . "'><img src='images/common/page_white_excel.png' class='action' /></a> -->\n\t\t";