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($_POST['remove'])) $array