45 parent::__construct(
$cn);
55 return $this->filename;
66 $this->filename = $filename;
86 $this->SetFont(
'Arial',
'', 8);
88 parent::Cell(0, 8,
" Page " . $this->PageNo() .
'/{nb}', 0, 0,
'C');
96 $this->SetFont(
'DejaVu',
'', 6);
99 $this->
write_multi($colsize, 3, $this->data[
'e_date'], border:
'', align:
'R');
114 $email_company = $this->
cn->get_value(
"select pe_value from parameter_extra where pe_code=$1",
115 [
'INVOICE_EMAIL_COMPANY']);
116 $site = $this->
cn->get_value(
"select pe_value from parameter_extra where pe_code=$1",
119 $siren = $this->
cn->get_value(
"select pe_value from parameter_extra where pe_code=$1",
121 $siret = $this->
cn->get_value(
"select pe_value from parameter_extra where pe_code=$1",
123 $iban = $this->
cn->get_value(
"select pe_value from parameter_extra where pe_code=$1",
124 [
'COMPANY_BANK_IBAN']);
125 $bic = $this->
cn->get_value(
"select pe_value from parameter_extra where pe_code=$1",
126 [
'COMPANY_BANK_BIC']);
140 $this->
write_multi($colsize, 3,
"IBAN $iban BIC $bic");
150 if ($email_company !=
"")
163 $this->setFont(
"DejaVu",
'B', 14);
165 $this->
write_multi(100, 10,
_(
"Facture") .
" " . $this->data[
'e_pj'], border: 1, align:
'C');
175 $this->SetAuthor(
'NOALYSS');
176 $this->AliasNbPages();
178 $this->SetAutoPageBreak(
true, $this->bMargin*1);
179 $this->setTitle($this->filename,
true);
181 $customer = new \Fiche($this->
cn);
182 $customer->get_by_qcode(trim($this->data[
'e_client']));
184 $this->setFont(
"DejaVu",
'', 7);
185 $this->write_cell(50, 4,
"");
186 $this->write_cell(60, 4, sprintf(
_(
"Echéance %s"), $this->data[
'e_ech']));
188 $this->write_cell(50, 4,
"");
189 $this->write_cell(100, 4,
_(
"Client"),
'B',
'R');
191 $this->write_cell(50, 4,
"");
192 $this->write_cell(110, 4, $customer->get_attribute(
ATTR_DEF_NAME)
195 $this->write_cell(50, 4,
"");
196 $this->write_cell(110, 4, $customer->get_attribute(
ATTR_DEF_ADRESS, 0));
198 $this->write_cell(50, 4,
"");
203 $this->write_cell(50, 4,
"");
206 $this->write_cell(50, 4,
"");
207 $this->write_cell(110, 4, $customer->get_attribute(
ATTR_DEF_NUMTVA, 0));
218 $this->SetFont(
"DejaVu",
"B", 12);
219 $this->write_multi(50, 20,
"");
220 $this->write_multi(50, 20,
_(
"Détails"));
222 $this->SetFont(
"DejaVu",
"B", 7);
223 $currency = new \Acc_Currency($this->
cn, $this->data[
'p_currency_code']);
224 $this->write_multi(100, 4, sprintf(
_(
"Les montants sont en %s taux %s")
226 , $this->data[
'p_currency_rate']));
228 $this->SetFont(
"DejaVuCond",
"", 7);
229 if ($this->data[
"bon_comm"] !=
"")
231 $this->write_multi(120, 4, sprintf(
_(
"Bon de commande / référence %s")
232 , $this->data[
"bon_comm"]));
236 $this->SetFont(
"DejaVu",
"", 7);
237 $this->write_multi($col[
'quick_code'], 4,
_(
"Article"), 1);
238 $this->write_multi($col[
'label'], 4,
_(
"Description"), 1);
239 $this->write_multi($col[
'quantity'], 4,
_(
"Quantité"), 1, align:
'C');
240 $this->write_multi($col[
'price'], 4,
_(
"Prix"), 1, align:
'C');
241 $this->write_multi($col[
'vat_code'], 4,
_(
"TVA"), 1, align:
'C');
247 for (
$i = 0;
$i < $this->data[
'nb_item'];
$i++)
249 $item = new \Fiche($this->
cn);
250 if (!isset($this->data[
'e_march' .
$i]) || $this->data[
'e_march' .
$i] ==
"")
255 $item->get_by_qcode(trim($this->data[
'e_march' .
$i]));
256 $fill = $this->is_fill(
$line);
257 $this->write_multi($col[
'quick_code'], 4, $item->get_attribute(
ATTR_DEF_QUICKCODE),
'',
'',$fill);
258 if ( isset ($this->data[
'e_march' .
$i .
'_label']))
260 $this->write_multi($col[
'label'], 4, $this->data[
'e_march' .
$i .
'_label'],fill:$fill);
262 $this->write_multi($col[
'label'], 4,$item->get_attribute(
ATTR_DEF_NAME),fill:$fill);
264 $this->write_multi($col[
'quantity'], 4,
nbm($this->data[
'e_quant' .
$i]),
'',
'R',fill:$fill);
265 $this->write_multi($col[
'price'], 4,
nbm($this->data[
'e_march' .
$i .
'_price']),
'',
'R',fill:$fill);
266 $this->write_multi($col[
'vat_code'], 4, $this->data[
'e_march' .
$i .
'_tva_id'],
'',
'C',fill:$fill);
267 $x = $this->data[
'e_march' .
$i .
'_tva_id'];
268 if (!isset($a_tva_amount[
$x]))
270 $a_tva_amount[
$x] = 0;
272 $a_tva_amount[
$x] = bcadd($a_tva_amount[
$x], $this->data[
"e_march" .
$i .
"_tva_amount"], 2);
274 , bcmul($this->data[
'e_march' .
$i .
'_price']
275 , $this->data[
'e_quant' .
$i]
280 , $this->data[
'e_march' .
$i .
'_tva_amount']
283 if ($this->GetY()>250) {
288 $this->SetFont(
"DejaVu",
"B", 9);
289 $this->write_multi(30, 4,
_(
"TVA"));
291 $this->SetFont(
"DejaVu",
"", 7);
292 foreach ($a_tva_amount as $tva_id => $tva_amount)
294 $tva = \Acc_Tva::build($this->
cn, $tva_id);
295 $this->write_multi(20, 4,
"");
296 $this->write_multi(80, 4, $tva->tva_id
297 .
" / " . $tva->tva_code
298 .
" / " . $tva->tva_label
299 .
" / " . $tva->tva_rate * 100
302 $this->write_multi(50, 4, $tva_amount,align:
'R');
306 $this->SetFont(
"DejaVu",
"B", 9);
307 $this->write_multi(30, 4,
_(
"TOTAUX"));
309 $this->SetFont(
"DejaVu",
"", 7);
310 $this->write_multi(60, 4,
_(
"Total Hors TVA "));
313 $this->write_multi(60, 4,
_(
"Total TVA "));
316 $this->write_multi(60, 4,
_(
"Total "));
319 $iban = $this->
cn->get_value(
"select pe_value from parameter_extra where pe_code=$1",
320 [
'COMPANY_BANK_IBAN']);
321 if ($this->data[
'e_ech'] !=
"" && $iban !=
"")
323 $info = ($this->data[
"other_info"] ==
"") ? $this->data[
"e_pj"] : $this->data[
"other_info"];
324 $bic = $this->
cn->get_value(
"select pe_value from parameter_extra where pe_code=$1",
325 [
'COMPANY_BANK_IBAN']);
326 $this->write_multi(150, 4,
327 sprintf(
_(
"Paiement avant le %s sur le compte %s (BIC %s) avec comme message %s"),
331 , $this->data[
"other_info"]
336 $this->Output($this->dirname . DIRECTORY_SEPARATOR . $this->filename,
"F");