예제 #1
0
    function JLMS_salesReportPDF($rows)
    {
        global $JLMS_CONFIG;
        include JPATH_SITE . DS . 'components' . DS . 'com_joomla_lms' . DS . 'includes' . DS . 'pdf' . DS . 'lms.pdf.php';
        $pdf = new JLMSPDF('P', 'mm', 'A4', true, 'UTF-8', false);
        //A4 Portrait
        $pdf->SetXY(0, 0);
        $pdf->SetMargins(10, 20, 10, true);
        $pdf->setFont('freesans');
        //choose font
        $pdf->setFontSize(8);
        //choose font
        $pdf->SetDrawColor(0, 0, 0);
        $header = "<br /><div align=\"center\">" . $JLMS_CONFIG->get('sitename') . ' - ' . strtolower(_JLMS_PAYS_SALES_REPORT) . "</div>";
        $footer = "\n\t\t\t<hr />\n\t\t\t<table width=\"100%\">\n\t\t\t    <tr>\n\t\t\t        <td align=\"left\">" . $JLMS_CONFIG->get('live_site') . "</td>\n\t\t";
        if ($JLMS_CONFIG->get('is_trial')) {
            $footer .= "<td align=\"center\">Powered by JoomlaLMS (www.joomlalms.com)</td>";
        }
        $footer .= "\n\t\t\t        <td align=\"right\">" . date('j F, Y, H:i', time() + $JLMS_CONFIG->get('offset') * 60 * 60) . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $pdf->getAliasNumPage() . ' / ' . $pdf->getAliasNbPages() . "</td>\n\t\t\t    </tr>\t\t  \n\t\t\t</table>\n\t\t";
        $pdf->setHeaderFont(array('freesans', '', 6));
        $pdf->setHeaderHTML($header);
        $pdf->setFooterMargin(5);
        $pdf->setFooterFont(array('freesans', '', 6));
        $pdf->setFooterHTML($footer);
        $pdf->AddPage();
        ob_clean();
        ob_start();
        ?>
		
		
			<table width="100%">		
				<tr>
					<th width="5%" align="center"><strong>#</strong></th>									
					<th width="80%"><strong><?php 
        echo _JLMS_PAYS_SUBS_NAME;
        ?>
</strong></th>
					<th width="15%"><strong><?php 
        echo _JLMS_PAYS_NUMB_OF_ORDERS;
        ?>
</strong></th>						
				</tr>	
				<tr><td colspan="3"><hr /></td></tr>	
			<?php 
        $k = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row = $rows[$i];
            ?>
				<tr>
					<td width="5%" align="center"><?php 
            echo $i + 1;
            ?>
</td>									
					<td width="80%" align="left">
						<?php 
            echo $row->name;
            ?>
					</td>	
					<td width="15%" align="center">
						<?php 
            echo $row->count;
            ?>
					</td>									
				</tr>
				<?php 
        }
        ?>
			
			</table>					
		<?php 
        $content = ob_get_contents();
        ob_end_clean();
        $pdf->writeHTML($content);
        $pdf->Output('sales_report', 'I');
        die;
    }