init
This commit is contained in:
86
modules/EcmProductReports/CreatePDF.php
Executable file
86
modules/EcmProductReports/CreatePDF.php
Executable file
@@ -0,0 +1,86 @@
|
||||
<?
|
||||
set_time_limit(3000);
|
||||
define('RELATIVE_PATH','include/html2fpdf/');
|
||||
define('FPDF_FONTPATH','include/html2fpdf/font/');
|
||||
require_once("include/html2fpdf/html2fpdf.php");
|
||||
include_once("modules/EcmProductReports/vtigerConnector.php");
|
||||
|
||||
$vc=new vtigerConnector();
|
||||
if($_POST['where'])$vc->where=$_POST['where'];
|
||||
if(!$_POST['start'])$vc->limit="0,".$vc->pp;
|
||||
else $vc->limit=$_POST['start'].",".$vc->pp;
|
||||
if($_POST['order_by'])$vc->order_by=$_POST['order_by'];
|
||||
else $vc->order_by="purchaseorder.duedate";
|
||||
if($_POST['sorder'])$vc->sorder=$_POST['sorder'];
|
||||
else $vc->sorder="desc";
|
||||
|
||||
$vc->getData();
|
||||
$vc->getCount();
|
||||
$data=$vc->data=$_SESSION['EcmProductReportsData'];
|
||||
|
||||
foreach($_REQUEST['check'] as $che)if($che)$ile++;
|
||||
|
||||
$pdf = new HTML2FPDF("L");
|
||||
|
||||
$j=0;
|
||||
$k=0;
|
||||
$m=0;
|
||||
for($i=0;$i<count($data);$i++){
|
||||
if($j==0){
|
||||
$html.='<table border="1" width="1050"><tr height="80" width="1050">';
|
||||
$html.='<td height="80" align="center" width="210"><img src="modules/EcmPriceBooks/e5.png" border="0" width="200" height="70"></td>';
|
||||
$html.='<td height="80" align="center" width="840"><font color="#808080">'.iconv("UTF-8","ISO-8859-2","Product Report").'</font></td>';
|
||||
$html.='</tr></table>';
|
||||
$html.='<table border="1" width="1050"><tr align="center" height="30" width="1220">';
|
||||
$html.='<td bgcolor="#FF6600" align="center" height="30" width="255"><font color="#ffffff">Product</font></td>';
|
||||
$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Code</font></td>';
|
||||
$html.='<td bgcolor="#FF6600" align="center" height="30" width="255"><font color="#ffffff">Purchase Order</font></td>';
|
||||
//$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Status</font></td>';
|
||||
$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Due Date</font></td>';
|
||||
$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Delivery Time</font></td>';
|
||||
//$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">List Price</font></td>';
|
||||
$html.='<td bgcolor="#FF6600" align="center" height="30" width="90"><font color="#ffffff">Quantity</font></td>';
|
||||
$html.='<td bgcolor="#FF6600" align="center" height="60" width="90"><font color="#ffffff">Tracking No</font></td>';
|
||||
$html.='</tr>';
|
||||
}
|
||||
|
||||
if(!$_REQUEST['check'][$i])continue;
|
||||
|
||||
$id=$vc->getIdByCode($data[$i]['productcode']);
|
||||
$duedate=$data[$i]['duedate'];
|
||||
$exp=explode("-",$duedate);
|
||||
$dtime=date("Y-m-d",@mktime(0,0,0,$exp[1],$exp[2],$exp[0])+37*24*3600);
|
||||
|
||||
$html.='<tr height="30" width="300">';
|
||||
$html.='<td valign="top" align="center" height="30" width="80">'.iconv("UTF-8","ISO-8859-2",$data[$i]['productname']).'</td>';
|
||||
$html.='<td valign="top" align="center" height="30" width="40">'.iconv("UTF-8","ISO-8859-2",$data[$i]['productcode']).'</td>';
|
||||
$html.='<td valign="top" align="center" height="30" width="80">'.iconv("UTF-8","ISO-8859-2",$data[$i]['subject']).'</td>';
|
||||
//$html.='<td valign="top" align="center" height="30" width="30">'.iconv("UTF-8","ISO-8859-2",$data[$i]['postatus']).'</td>';
|
||||
$html.='<td valign="top" align="center" height="30" width="50">'.iconv("UTF-8","ISO-8859-2",$vc->timeDate($duedate)).'</td>';
|
||||
$html.='<td valign="top" align="center" height="30" width="60">'.iconv("UTF-8","ISO-8859-2",$vc->timeDate($dtime)).'</td>';
|
||||
//$html.='<td valign="top" align="center" height="30" width="40">'.iconv("UTF-8","ISO-8859-2",$vc->formatNumber($data[$i]['listprice'])).'</td>';
|
||||
$html.='<td valign="top" align="center" height="30" width="40">'.iconv("UTF-8","ISO-8859-2",$data[$i]['quantity']).'</td>';
|
||||
$html.='<td valign="top" align="center" height="30" width="60">'.iconv("UTF-8","ISO-8859-2",$data[$i]['tracking_no']).'</td>';
|
||||
|
||||
$html.='</tr>';
|
||||
|
||||
$j++;
|
||||
$k++;
|
||||
$m++;
|
||||
|
||||
if($j==17 || $ile==$k){
|
||||
$st++;
|
||||
$html.='</table>';
|
||||
$html.='<table border="1" width="1050"><tr height="30" width="1050">';
|
||||
$html.='<td bgcolor="#FF6600" height="30" align="center" width="200"><font color="#ffffff">www.e5world.com</font></td>';
|
||||
$html.='<td bgcolor="#FF6600" height="30" align="right" width="850">'.$st.'/'.ceil($ile/17).' </td>';
|
||||
$html.='</tr></table>';
|
||||
$ohtml=$html;
|
||||
$html='';
|
||||
$pdf->AddPage();
|
||||
$pdf->WriteHTML($ohtml);
|
||||
$j=0;
|
||||
}
|
||||
}
|
||||
$pdf->Output("ProductsReport.pdf", "D");
|
||||
?>
|
||||
Reference in New Issue
Block a user