当前位置: 首页>>代码示例>>PHP>>正文


PHP FPDI::startPage方法代码示例

本文整理汇总了PHP中FPDI::startPage方法的典型用法代码示例。如果您正苦于以下问题:PHP FPDI::startPage方法的具体用法?PHP FPDI::startPage怎么用?PHP FPDI::startPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FPDI的用法示例。


在下文中一共展示了FPDI::startPage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateStockStatusReport


//.........这里部分代码省略.........
                    $fetchDataList['999' . '3'] = number_format($fetchDataList['999' . '3'], 1);
                    array_unshift($fetchDataList, $sl, $preItemName);
                    $aData[] = $fetchDataList;
                    $sl++;
                }
                $count++;
                $preItemName = $row['ItemName'];
                unset($fetchDataList);
                foreach ($headerList as $key => $value) {
                    $fetchDataList[$key . '1'] = NULL;
                    $fetchDataList[$key . '2'] = NULL;
                    $fetchDataList[$key . '3'] = NULL;
                }
                $tmpItemName = $row['ItemName'];
            }
            $fLevelId = $row['FLevelId'];
            $fetchDataList[$fLevelId . '1'] = number_format($row['FacilityAMC']);
            $fetchDataList[$fLevelId . '2'] = number_format($row['FacilitySOH']);
            $fetchDataList[$fLevelId . '3'] = number_format($row['MOS'], 1);
            if ($fetchDataList['999' . '1'] < $row['FacilityAMC']) {
                $fetchDataList['999' . '1'] = number_format($row['FacilityAMC']);
            }
            $fetchDataList['999' . '2'] += $row['FacilitySOH'];
            $fetchDataList['999' . '3'] += $row['MOS'];
        }
        $fetchDataList['999' . '2'] = number_format($fetchDataList['999' . '2']);
        $fetchDataList['999' . '3'] = number_format($fetchDataList['999' . '3'], 1);
        array_unshift($fetchDataList, $sl, $preItemName);
        $aData[] = $fetchDataList;
        $col = '';
        $col .= ' <tr><th rowspan="2" style="text-align:center; width:5%;"><b>SL</b></th>
		  <th rowspan="2" style="text-align:center; width:10%;"><b>' . $gTEXT['Product Name'] . '</b></th>';
        $Header = '-1';
        for ($i = 0; $i < count($columnList); $i++) {
            if ($Header != $columnList[$i]) {
                $col .= '<th colspan="3" style="text-align:center;width:90px;"><b>' . $columnList[$i] . '</b></th>';
                $Header = $columnList[$i];
            }
        }
        $index = 0;
        $col .= '</tr><tr>';
        for ($i = 0; $i < count($columnList); $i++) {
            $index++;
            if ($index == 1) {
                $col .= '<th  style="text-align:left; ">AMC</th>';
            } else {
                if ($index == 2) {
                    $col .= '<th  style="text-align:left; ">SOH</th>';
                } else {
                    if ($index == 3) {
                        $col .= '<th  style="text-align:left; ">' . $gTEXT['MOS'] . '</th>';
                    }
                }
            }
            if ($index == 3) {
                $index = 0;
            }
        }
        $col .= '</tr>';
        $data = '';
        for ($p = 0; $p < count($aData); $p++) {
            $data .= '<tr>';
            for ($i = 0; $i < count($aData[$p]); $i++) {
                $data .= '<td>' . $aData[$p][$i] . '</td>';
            }
            $data .= '</tr>';
        }
        $pdf->startPage();
        $html_head = "<span><b>" . $gTEXT['Stock Status at Different Level Data List'] . "</b></span>";
        $pdf->SetFont('dejavusans', '', 9);
        $pdf->writeHTMLCell(0, 0, 3, 10, $html_head, '', 0, 0, false, 'C', true);
        $html = '
        <!-- EXAMPLE OF CSS STYLE -->
        <style>
         td{
             height: 6px;
             line-height:3px;
         }
         th{
            height:20;
            font-size:6px;
        }
        </style>
        <body>
        <table width="510px" border="0.5" style="margin:0 auto;">
        ' . $col . '' . $data . '</table>
        </body>';
        $pdf->SetFont('dejavusans', '', 6);
        $pdf->writeHTMLCell(0, 0, '', 20, $html, '', 1, 1, false, 'L', true);
        $pdf->endPage();
        $filePath = SITEDOCUMENT . 'administrator/components/com_jcode/source/report/pdfslice/StockStatusatDifferentLevelReport.pdf';
        if (file_exists($filePath)) {
            unlink($filePath);
        }
        $pdf->Output('pdfslice/StockStatusatDifferentLevelReport.pdf', 'F');
        echo 'StockStatusatDifferentLevelReport.pdf';
    } else {
        echo 'Processing Error';
    }
}
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:101,代码来源:r_report_stock_status_different_level_pdf.php

示例2: generatePipelineReport

function generatePipelineReport($conn)
{
    global $gTEXT;
    $year = $_POST['YearId'];
    $MonthName = $_POST['MonthName'];
    $CountryName = $_POST['CountryName'];
    require_once 'tcpdf/tcpdf.php';
    require_once 'fpdf/fpdi.php';
    $pdf = new FPDI();
    $pdf->SetPrintHeader(false);
    $pdf->SetPrintFooter(false);
    $pdf->AddPage();
    $pdf->SetFillColor(255, 255, 255);
    $html_head = "<span style='text-align:center;'><b>" . $gTEXT['National Stock Pipeline Information Report of'] . " " . $CountryName . " On " . $MonthName . ", " . $year . "</b></span>";
    $html = '
    <!-- EXAMPLE OF CSS STYLE -->
    <style>
    </style>
    <body>
        <h4 style="text-align:center;"><b>' . $gTEXT['National Stock Pipeline Information Report of'] . '  ' . $CountryName . ' ' . $gTEXT['on'] . ' ' . $MonthName . ',' . $year . '</b></h4>
    </body>';
    $pdf->writeHTMLCell(0, 0, 20, '', $html_head, '', 1, 1, false, 'C', true, $spacing = 0);
    $pdf->setSourceFile("pdfslice/PipelineInfoChart.pdf");
    $tplIdx = $pdf->importPage(1);
    $pdf->useTemplate($tplIdx, 3, 0, 200, 400);
    $pdf->endPage();
    //=====================================================Pipeline Info List Table=======================================================
    $monthId = $_POST['MonthId'];
    $year = $_POST['YearId'];
    $countryId = $_POST['CountryId'];
    $itemGroupId = $_POST['ItemGroupId'];
    $currentYearMonth = $_POST['YearId'] . "-" . $_POST['MonthId'] . "-" . "01";
    $monthList = array('1' => 'January', '2' => 'February', '3' => 'March', '4' => 'April', '5' => 'May', '6' => 'June', '7' => 'July', '8' => 'August', '9' => 'September', '10' => 'October', '11' => 'November', '12' => 'December');
    $sWhere = "";
    if ($_POST['sSearch'] != "") {
        $sWhere = " WHERE (a.ItemName LIKE '%" . mysql_real_escape_string($_POST['sSearch']) . "%'\n        OR " . " a.AMC LIKE '%" . mysql_real_escape_string($_POST['sSearch']) . "%'\n        OR " . " a.ClStock LIKE '%" . mysql_real_escape_string($_POST['sSearch']) . "%' \n        OR " . " a.MOS LIKE '%" . mysql_real_escape_string($_POST['sSearch']) . "%'\n        OR " . " b.Qty LIKE '%" . mysql_real_escape_string($_POST['sSearch']) . "%' \n        )";
    }
    $sLimit = "";
    if (isset($_GET['iDisplayStart']) && $_GET['iDisplayLength'] != '-1') {
        $sLimit = "LIMIT " . intval($_GET['iDisplayStart']) . ", " . intval($_GET['iDisplayLength']);
    }
    $sOrder = "";
    if (isset($_POST['iSortCol_0'])) {
        $sOrder = " ORDER BY  ";
        for ($i = 0; $i < mysql_real_escape_string($_POST['iSortingCols']); $i++) {
            $sOrder .= fnColumnToField_Item(mysql_real_escape_string($_POST['iSortCol_' . $i])) . "\n\t\t\t\t\t\t\t\t" . mysql_real_escape_string($_POST['sSortDir_' . $i]) . ", ";
        }
        $sOrder = substr_replace($sOrder, "", -2);
    }
    $sql = "  SELECT ItemName, IFNULL(AMC,0) AMC, IFNULL(ClStock,0) ClStock, IFNULL(MOS,0) MOS, IFNULL(Qty,0) StockOnOrder \n            FROM (SELECT\n                    t_cnm_masterstockstatus.CountryId,\n                    t_itemlist.ItemNo,\n                    t_itemlist.ItemName,\n                    SUM(t_cnm_stockstatus.AMC)    AMC,\n                    SUM(t_cnm_stockstatus.ClStock)    ClStock,\n                    SUM(t_cnm_stockstatus.MOS)    MOS\n                    FROM t_cnm_stockstatus\n                    INNER JOIN t_cnm_masterstockstatus\n                    ON (t_cnm_stockstatus.CNMStockId = t_cnm_masterstockstatus.CNMStockId)\n                    INNER JOIN t_itemlist\n                    ON (t_cnm_stockstatus.ItemNo = t_itemlist.ItemNo)\n                    WHERE (t_cnm_masterstockstatus.Year = '{$year}'\n                    AND t_cnm_masterstockstatus.MonthId = {$monthId}\n                    AND t_cnm_masterstockstatus.CountryId = {$countryId}\n                    AND t_cnm_masterstockstatus.ItemGroupId = {$itemGroupId}\n                    AND t_cnm_masterstockstatus.StatusId = 5)\n                    GROUP BY t_cnm_masterstockstatus.CountryId, t_itemlist.ItemNo, t_itemlist.ItemName) a \n            LEFT JOIN (SELECT\n                        CountryId, ItemNo, SUM(Qty) Qty\n                        FROM t_agencyshipment\n                        WHERE (ShipmentDate > CAST('{$currentYearMonth}' AS DATETIME)  AND ShipmentStatusId = 2)\n                        GROUP BY CountryId, ItemNo) b\n            ON a.CountryId = b.CountryId AND a.ItemNo = b.ItemNo\n            " . $sWhere . "\n            HAVING AMC>0 OR MOS>0 OR ClStock>0 OR StockOnOrder>0\n            ORDER BY ItemName\n            {$sLimit}";
    //
    $result = mysql_query($sql, $conn);
    $total = mysql_num_rows($result);
    if ($total > 0) {
        $data = array();
        $f = 0;
        $tblHTML = '';
        while ($rec = mysql_fetch_array($result)) {
            $data['SL'][$f] = $f;
            $data['ItemName'][$f] = $rec['ItemName'];
            $data['AMC'][$f] = number_format($rec['AMC']);
            $data['ClStock'][$f] = number_format($rec['ClStock']);
            $data['MOS'][$f] = number_format($rec['MOS'], 1);
            $data['StockOnOrder'][$f] = $rec['StockOnOrder'] == 0 ? '' : $rec['StockOnOrder'];
            $amc = $rec['AMC'] == 0 ? 1 : $rec['AMC'];
            $stockOnOrderMOS = $rec['StockOnOrder'] / $amc;
            $stockOnOrderMOS = $stockOnOrderMOS == 0 ? '' : number_format($stockOnOrderMOS, 1);
            $totalMOS = number_format(number_format($rec['MOS'], 1) + $stockOnOrderMOS, 1);
            $totalMOS = $totalMOS == 0 ? '' : $totalMOS;
            //$data['StockOnOrderMOS'][$f] = $rec['StockOnOrderMOS']== 0? '' : $rec['StockOnOrderMOS'];
            //$data['TotalMOS'][$f] = $rec['TotalMOS']== 0? '' : $rec['TotalMOS'];
            $tblHTML .= '<tr style="page-break-inside:avoid;">
                            <td align="center" width="20" valign="middle">' . ($data['SL'][$f] + 1) . '</td>  
                            <td align="left" width="150" valign="middle">' . $data['ItemName'][$f] . '</td>
                            <td align="right" width="50" valign="middle">' . $data['AMC'][$f] . '</td>
                            <td align="right" width="70" valign="middle">' . $data['ClStock'][$f] . '</td>
                            <td align="right" width="74" valign="middle">' . $data['MOS'][$f] . '</td>
                            <td align="right" width="50" valign="middle">' . $data['StockOnOrder'][$f] . '</td>
                            <td align="right" width="70" valign="middle">' . $stockOnOrderMOS . '</td>
                            <td align="right" width="50" valign="middle">' . $totalMOS . '</td> 
                    </tr>';
            $f++;
        }
        $pdf->startPage();
        $html_head = "<span><b>" . $gTEXT['National Stock Pipeline Information List'] . "</b></span>";
        $pdf->SetFont('dejavusans', '', 10);
        $pdf->writeHTMLCell(0, 0, 10, 15, $html_head, '', 0, 0, false, 'C', true);
        $html = '
            <!-- EXAMPLE OF CSS STYLE -->
            <style>
             td{
                 height: 6px;
                 line-height:3px;
             }
            </style>
            <body>
            <table width="600px" border="0.5" style="margin:0 auto;">
            	  <tr>
            		<th width="20" align="center"><b>SL</b></th>
                    <th width="150" align="left"><b>' . $gTEXT['Products'] . '</b></th>
//.........这里部分代码省略.........
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:101,代码来源:r_pipeline_info_pdf.php


注:本文中的FPDI::startPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。