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


PHP FPDI::endPage方法代码示例

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


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

示例1: generateStockStatusReport

function generateStockStatusReport($conn)
{
    global $gTEXT;
    $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->SetAutoPageBreak(true, 1);
    //$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
    $pdf->AddPage();
    $pdf->SetFillColor(255, 255, 255);
    $html_head = "<span style='text-align:center;font-size:10px;'><b>" . $gTEXT['Stock Status at Different Level Report of'] . " " . $CountryName . " on " . $MonthName . ", " . $Year . "</b></span>";
    $html = <<<EOF
    <!-- EXAMPLE OF CSS STYLE -->
    <style>
    </style>
    <body>
        
    </body>
EOF;
    $pdf->writeHTMLCell(0, 0, 40, '', $html_head, '', 1, 1, false, 'L', true);
    $pdf->setSourceFile("pdfslice/StockStatusChart.pdf");
    $tplIdx = $pdf->importPage(1);
    $pdf->useTemplate($tplIdx, 6, 20, 200, 300);
    $pdf->endPage();
    //=====================================================Stock List Table=======================================================
    $Year = $_POST['Year'];
    $ItemGroupId = $_POST['ItemGroup'];
    $Month = $_POST['Month'];
    $CountryId = $_POST['Country'];
    $ownnerTypeId = $_POST['OwnnerTypeId'];
    $lan = $_REQUEST['lan'];
    if ($lan == 'en-GB') {
        $fLevelName = 'FLevelName';
    } else {
        $fLevelName = 'FLevelNameFrench';
    }
    if ($CountryId) {
        $CountryId = " AND a.CountryId = " . $CountryId . " ";
    }
    $columnList = array();
    $productName = 'Product Name';
    $aData = array();
    if ($ownnerTypeId == 1 || $ownnerTypeId == 2) {
        $sQuery = "SELECT f.FLevelId, {$fLevelName} FLevelName, a.ItemNo, b.ItemName, f.ColorCode, IFNULL(SUM(ClStock),0) FacilitySOH, IFNULL(SUM(AMC),0) FacilityAMC\n\t\t\t, IFNULL(((SUM(ClStock))/(SUM(AMC))),0) MOS                 \n            FROM t_cfm_stockstatus a \n            INNER JOIN t_itemlist b ON a.ItemNo = b.ItemNo AND b.bKeyItem = 1 AND b.ItemGroupId = " . $ItemGroupId . "\n            INNER JOIN t_cfm_masterstockstatus c ON a.CFMStockId = c.CFMStockId and c.StatusId = 5 AND c.ItemGroupId = " . $ItemGroupId . "\n            INNER JOIN t_facility d ON a.FacilityId = d.FacilityId\n            INNER JOIN t_facility_group_map e ON d.FacilityId = e.FacilityId AND e.ItemGroupId = " . $ItemGroupId . "\n            INNER JOIN t_facility_level f ON d.FLevelId = f.FLevelId\n            WHERE a.MonthId = " . $Month . " AND a.Year = '" . $Year . "' " . $CountryId . "\n\t\t\tAND d.OwnerTypeId  = " . $ownnerTypeId . "\n            GROUP BY f.FLevelId, {$fLevelName}, ItemNo, ItemName, f.ColorCode\n            HAVING IFNULL(((SUM(ClStock))/(SUM(AMC))),0)>0\n\t\t\torder by ItemName,f.FLevelId;";
    } else {
        $sQuery = "SELECT f.FLevelId, {$fLevelName} FLevelName, a.ItemNo, b.ItemName, f.ColorCode, IFNULL(SUM(ClStock),0) FacilitySOH, IFNULL(SUM(AMC),0) FacilityAMC\n\t\t\t\t, IFNULL(((SUM(ClStock))/(SUM(AMC))),0) MOS                 \n\t\t\t\tFROM t_cfm_stockstatus a \n\t\t\t\tINNER JOIN t_itemlist b ON a.ItemNo = b.ItemNo AND b.bKeyItem = 1 AND b.ItemGroupId = " . $ItemGroupId . "\n\t\t\t\tINNER JOIN t_cfm_masterstockstatus c ON a.CFMStockId = c.CFMStockId and c.StatusId = 5 AND c.ItemGroupId = " . $ItemGroupId . "\n\t\t\t\tINNER JOIN t_facility d ON a.FacilityId = d.FacilityId\n\t\t\t\tINNER JOIN t_facility_group_map e ON d.FacilityId = e.FacilityId AND e.ItemGroupId = " . $ItemGroupId . "\n\t\t\t\tINNER JOIN t_facility_level f ON d.FLevelId = f.FLevelId\n\t\t\t\tWHERE a.MonthId = " . $Month . " AND a.Year = '" . $Year . "' " . $CountryId . "\n\t\t\t\tAND d.AgentType = " . $ownnerTypeId . "\n\t\t\t\tGROUP BY f.FLevelId, {$fLevelName}, ItemNo, ItemName, f.ColorCode\n\t\t\t\tHAVING IFNULL(((SUM(ClStock))/(SUM(AMC))),0)>0\n\t\t\t\torder by ItemName,f.FLevelId;";
    }
    //echo $sQuery;
    $rResult = safe_query($sQuery);
    $total = mysql_num_rows($rResult);
    $tmpItemName = '';
    $sl = 1;
    $count = 0;
    $preItemName = '';
    //echo 'Rubel';
    if ($total > 0) {
        $data = array();
        $headerList = array();
        while ($row = mysql_fetch_assoc($rResult)) {
            $data[] = $row;
        }
        foreach ($data as $row) {
            ////Duplicate value not push in array
            //if (!in_array($row['FLevelName'], $headerList)) {
            //	$headerList[] = $row['FLevelName'];
            //}
            $headerList[$row['FLevelId']] = $row['FLevelName'];
        }
        //array_push($headerList,'National');
        $headerList[999] = 'National';
        foreach ($headerList as $key => $value) {
            $columnList[] = $value;
            //.' Level AMC';
            $columnList[] = $value;
            //.' Level SOH';
            $columnList[] = $value;
            //.' Level MOS';
        }
        $fetchDataList = array();
        foreach ($data as $row) {
            if ($tmpItemName != $row['ItemName']) {
                if ($count > 0) {
                    $fetchDataList['999' . '2'] = number_format($fetchDataList['999' . '2']);
                    $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;
                }
//.........这里部分代码省略.........
开发者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::endPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。