SetLeftMargin(10); $p->SetRightMargin(10); $p->SetTopMargin(10); $p->SetAutoPageBreak(true,10); $p->AddPage(); $p->SetFont('arialpl','B',16); $x=0; $y=0; for($i=0;$iImage('modules/EcmCharts/files/'.$ar[$i].'.png',$x,$y,190);$p->Ln(); $p->SetFont('arialpl','B',8); $p->Cell(25,4,"Index",0,0,"L",1); $p->Cell(75,4,"Name",0,0,"L",1); $p->Cell(20,4,"Sales",0,0,"L",1); $p->Cell(15,4,"Quantity",0,0,"L",1); $p->Cell(20,4,"Margin PLN",0,0,"L",1); $p->Cell(15,4,"Margin %",0,0,"L",1); //$p->Cell(20,4,"Price",0,0,"L",1); $p->Ln(); $ars[$i]=multisort($ars[$i],array(array('key'=>'sales','sort'=>'desc'))); foreach($ars[$i] as $k=>$s){ $r=mysql_fetch_array(mysql_query("select code,name from ecmproducts where id='".$k."'")); $rp=mysql_fetch_array(mysql_query("select i.price from ecmpricebooks_ecmproducts as i inner join ecmpricebooks as e on e.id=i.ecmpricebook_id where where i.ecmproduct_id='".$k."' and e.account_id='".$account."' and e.name='Carrefour' and deleted='0'")); $p->SetFont('arialpl','',8); $p->Cell(25,4,$r['code'],0,0,"L",1); $p->Cell(75,4,iconv("UTF-8","ISO-8859-2",$r['name']),0,0,"L",1); $p->Cell(20,4,number_format($s['sales'],2,",","."),0,0,"L",1); $p->Cell(15,4,number_format($s['quantity'],0,",","."),0,0,"L",1); $p->Cell(20,4,number_format(($s['sales']-$s['purchase']),2,",","."),0,0,"L",1); $p->Cell(15,4,number_format((100*($s['sales']-$s['purchase'])/$s['sales']),2,",",".")."%",0,0,"L",1); //$p->Cell(20,4,$rp['price'],0,0,"L",1); $p->Ln(); } $x=$p->GetX(); $y=$p->GetY(); } $p->Output("Chart.pdf","I"); ?>