altocompta/include/export_form_pdf.php
Dany De Bontridder cd285a1bac Merged revisions 4797-4802 via svnmerge from
svn+ssh://ns352270.ovh.net/svn/phpcompta/tags/rel600

........
  r4797 | danydb | 2012-03-27 20:24:27 +0200 (Tue, 27 Mar 2012) | 2 lines
  
  Force the download, problem with adobe plugin.
  Limit size of description in export_poste_detail_pdf.php
........
  r4798 | danydb | 2012-03-27 23:22:04 +0200 (Tue, 27 Mar 2012) | 1 line
  
  ajout quick code dans pdf
........
  r4799 | danydb | 2012-03-27 23:22:25 +0200 (Tue, 27 Mar 2012) | 1 line
  
  ajout le code journal dans la requête
........
  r4800 | danydb | 2012-03-28 15:23:08 +0200 (Wed, 28 Mar 2012) | 1 line
  
  faire apparentre nom,id et quickcode lors impression fiche (PRINTPOSTE)
........
  r4801 | danydb | 2012-03-31 19:09:51 +0200 (Sat, 31 Mar 2012) | 1 line
  
  Improve SQL2TABLE
........
  r4802 | danydb | 2012-04-12 00:15:30 +0200 (Thu, 12 Apr 2012) | 1 line
  
  Reconciliation check that jr_id does exist
........
2012-04-24 17:48:54 +00:00

129 lines
3.3 KiB
PHP

<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
// $Revision$
/*! \file
* \brief Send a report in PDF
*/
include_once("class_acc_report.php");
include_once("ac_common.php");
require_once('class_database.php');
include_once("class_impress.php");
require_once('class_user.php');
require_once ('header_print.php');
require_once('class_dossier.php');
require_once('class_acc_report.php');
require_once('class_pdf.php');
$gDossier=dossier::id();
$cn=new Database($gDossier);
extract($_GET);
$ret="";
$Form=new Acc_Report($cn,$form_id);
$Libelle=sprintf("%s ",$Form->get_name());
$pdf= new PDF($cn);
$pdf->setDossierInfo($Libelle);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetAuthor('Phpcompta');
$pdf->setTitle("Rapport ".$Libelle,true);
// Step ??
//--
if ( $_GET['p_step'] == 0 )
{
// No step asked
//--
if ( $_GET ['type_periode'] == 0 )
$array=$Form->get_row( $_GET['from_periode'],$_GET['to_periode'], $_GET['type_periode']);
else
$array=$Form->get_row( $_GET['from_date'],$_GET['to_date'], $_GET['type_periode']);
}
else
{
// yes with step
//--
for ($e=$_GET['from_periode'];$e<=$_GET['to_periode'];$e+=$_GET['p_step'])
{
$periode=getPeriodeName($cn,$e);
if ( $periode == null ) continue;
$array[]=$Form->get_row($e,$e,'periode');
$periode_name[]=$periode;
}
}
$pdf->SetFont('DejaVuCond','',8);
// without step
if ( $_GET['p_step'] == 0 )
{
if ( $_GET['type_periode'] == 0 )
{
$q=getPeriodeName($cn,$from_periode);
if ( $from_periode != $to_periode)
{
$periode=sprintf("Période %s à %s",$q,getPeriodeName($cn,$to_periode));
}
else
{
$periode=sprintf("Période %s",$q);
}
}
else
{
$periode=sprintf("Date %s jusque %s",$_GET['from_date'],$_GET['to_date']);
}
$pdf->Cell(0,7,$periode,'B');
$pdf->Ln();
for ($i=0;$i<count($array);$i++)
{
$pdf->Cell(160,6,$array[$i]['desc']);
$pdf->Cell(30,6,sprintf('% 12.2f',$array[$i]['montant']),0,0,'R');
$pdf->Ln();
}
}
else
{ // With Step
$a=0;
foreach ($array as $e)
{
$pdf->Cell(0,7,$periode_name[$a],'B');
$pdf->Ln();
$a++;
for ($i=0;$i<count($e);$i++)
{
$pdf->Cell(160,6,$e[$i]['desc']);
$pdf->Cell(30,6,sprintf('% 12.2f',$e[$i]['montant']),0,0,'R');
$pdf->Ln();
}
}
}
$fDate=date('dmy-Hi');
$pdf->Output('rapport-'.$fDate.'.pdf','D');
?>