コード例 #1
0
    $pdf->cell(75, 10, 'Description', 1, 0, 'C');
    $pdf->cell(42, 10, 'Amount Paid', 1, 0, 'C');
    $pdf->cell(42, 10, 'Paid By', 1, 0, 'C');
    $pdf->cell(42, 10, 'Paid Date', 1, 1, 'C');
    $pdf->setFont('Times', '', 14);
    if (mysqli_num_rows($result) != 0) {
        $grandtotal = 0.0;
        while (list($id, $date, $amount, $description, $name) = mysqli_fetch_array($result, MYSQLI_NUM)) {
            // 216 mm total, 203 writable
            $pdf->setX(7.5);
            $pdf->cell(75, 10, $description, 1, 0, 'L');
            $pdf->cell(42, 10, "\$" . number_format($amount, 2), 1, 0, 'C');
            $pdf->cell(42, 10, $name, 1, 0, 'C');
            $pdf->cell(42, 10, $date, 1, 1, 'C');
            $grandtotal += $amount;
        }
    } else {
        $grandtotal = 0.0;
        $pdf->cell(0, 10, 'There were no bills in the selected range.', 0, 1, 'C');
    }
    $pdf->setFont('Times', 'B', 14);
    // 216 mm total, 203 writable
    $pdf->setX(7.5);
    $pdf->cell(75, 10, 'Total', 1, 0, 'L');
    $pdf->cell(42, 10, "\$" . number_format($grandtotal, 2), 1, 0, 'C');
    $pdf->cell(42, 10, '', 1, 0, 'C');
    $pdf->cell(42, 10, '', 1, 1, 'C');
    $pdf->output();
} else {
    echo "Error";
}
コード例 #2
0
ファイル: export_pdf.php プロジェクト: apmuthu/phpMyOLAP
for ($i = 0; $i < $ncols; $i++) {
    $colname = mysql_fetch_field($result);
    $nome = $colname->name;
    $tabella = $colname->table;
    if ($tabella == "") {
        $field = "{$nome}";
    } else {
        $field = "{$tabella}.{$nome}";
    }
    $p->Text($w, $h, $field);
    $w = $w + $off_w;
}
//****************************************
$w = 10;
$h = $h + $off_h;
while ($row = mysql_fetch_array($result)) {
    for ($i = 0; $i < $ncols; $i++) {
        $colvalue = $row[$i];
        $p->Text($w, $h, $colvalue);
        $w = $w + $off_w;
    }
    $h = $h + $off_h;
    $w = 10;
    if ($h > 200) {
        $p->AddPage();
        $h = 10;
    }
}
$pdf_filename = "olap_" . date("Ymd_His") . ".pdf";
$p->output($pdf_filename);