22 require_once NOALYSS_INCLUDE.
'/lib/class_pdf.php';
30 if($p_cn == null) die(
"No database connection. Abort.");
32 parent::__construct($p_cn,
'P',
'mm',
'A4');
33 date_default_timezone_set (
'Europe/Paris');
46 $this->SetFont(
'DejaVu',
'B', 12);
48 $this->Cell(0,10,$this->dossier,
'B', 0,
'C');
57 $this->SetFont(
'Arial',
'I', 8);
59 $this->Cell(0,8,
'Date '.$this->date.
" - Page ".$this->PageNo().
'/{nb}',0,0,
'C');
62 $this->Cell(0,8,
'Created by NOALYSS, a professional opensource accounting software http://www.noalyss.eu',0,0,
'C',
false,
'http://www.noalyss.eu');
69 $array=$this->cn->get_array(
"select a_id , f_id , vw_name,vw_description,
70 account_deb , account_cred , a_amount ,
72 from amortissement.amortissement
73 left join vw_fiche_attr using(f_id)
77 $this->total_page=count(
$array);
78 $this->SetFont(
'DejaVu',
'BI',7);
81 for ($i=0;$i< count(
$array);$i++)
83 $this->SetFont(
'DejaVuCond',
'B',15);
85 $this->write_cell(0,0,
$row[
'vw_name'],0,0,
'C');
89 $this->SetFont(
'DejaVu',
'',7);
90 $this->write_cell(50,7,
'Montant');
91 $this->write_cell(50,7,nbm(
$row[
'a_amount']));
94 $this->write_cell(50,7,
"Année d'achat");
95 $this->write_cell(50,7,
$row[
'a_start']);
98 $this->write_cell(50,7,
"Poste charge");
99 $this->write_cell(50,7,
$row[
'account_deb']);
100 $deb=$this->cn->get_value(
"select pcm_lib from tmp_pcmn where pcm_val=$1",
101 array(
$row[
'account_deb']));
102 $this->write_cell(120,7,$deb);
105 $this->write_cell(50,7,
"Poste contrepartie");
106 $this->write_cell(50,7,
$row[
'account_cred']);
107 $cred=$this->cn->get_value(
"select pcm_lib from tmp_pcmn where pcm_val=$1",
108 array(
$row[
'account_cred']));
109 $this->write_cell(120,7,$cred);
112 $this->write_cell(50,7,
"Nbre annuités");
113 $this->write_cell(50,7,
$row[
'a_nb_year']);
119 $col=array(
'Année',
'Montant',
'Am. actés',
'Pièce',
'n° interne',
'%');
120 foreach ($col as $scol)
122 $this->write_cell(25,7,$scol,1);
126 $array_year=$this->cn->get_array(
"select ad_id , ad_amount , a_id , ad_year , ad_percentage ".
127 " from amortissement.amortissement_detail ".
128 " where a_id=$1 order by ad_year",
129 array(
$row[
'a_id']));
130 for ($e=0;$e<count($array_year);$e++)
132 $this->write_cell(25,7,$array_year[$e][
'ad_year'],1,0);
133 $this->write_cell(25,7,nbm($array_year[$e][
'ad_amount']),1,0,
'R');
134 $ret=$this->cn->exec_sql(
"select h_amount,h_pj,jr_internal from amortissement.amortissement_histo where a_id=$1 and h_year=$2",
135 array(
$row[
'a_id'],$array_year[$e][
'ad_year']));
136 $value=$this->cn->fetch_array(
$ret,0);
137 $this->write_cell(25,7,nbm($value[
'h_amount']),1,0,
'R');
138 $this->write_cell(25,7,$value[
'h_pj'],1,0);
139 $this->write_cell(25,7,$value[
'jr_internal'],1,0);
140 $pct=bcdiv($array_year[$e][
'ad_amount'],
$row[
'a_amount']);
141 $pct=bcmul($pct,100);
142 $this->write_cell(25,7,$pct,1,0,
'R');
147 if ($i < count(
$array)) $this->AddPage();
149 $this->Output(
'toutes_les_fiches.pdf',
'I');
for($i=0;$i< Database::num_row($ret);$i++) $row
if(!isset($_REQUEST['sb'])) $format
__construct(&$p_cn=null, $orientation= 'P', $unit= 'mm', $format= 'A4')
if(isset($_POST['remove'])) $array
setDossierInfo($dossier="n/a")