diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php index 9ede4addb52..2cfc6dcc3d5 100644 --- a/htdocs/admin/fournisseur.php +++ b/htdocs/admin/fournisseur.php @@ -137,7 +137,7 @@ if ($_GET["action"] == 'set') { } - else dol_print_error($db); +// else dol_print_error($db); } if ($_GET["action"] == 'del') @@ -151,7 +151,7 @@ if ($_GET["action"] == 'del') { } - else dol_print_error($db); +// else dol_print_error($db); } if ($_GET["action"] == 'setdoc') diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 577b7303b99..ea4b55abef7 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2040,14 +2040,14 @@ class Facture extends CommonObject /** - * \brief Return amount of payments already done - * \return int Amount of payment already done, <0 if KO + * Return amount of payments already done + * @return int Amount of payment already done, <0 if KO */ function getSommePaiement() { $table='paiement_facture'; $field='fk_facture'; - if ($this->element == 'facture_fourn') + if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') { $table='paiementfourn_facturefourn'; $field='fk_facturefourn'; @@ -2067,6 +2067,7 @@ class Facture extends CommonObject } else { + $this->error=$this->lasterror(); return -1; } } @@ -3060,7 +3061,7 @@ class FactureLigne // 1: frais de port // 2: ecotaxe // 3: ?? - + var $origin; var $origin_id; diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index f38c18f80f9..aff6b20c234 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -266,7 +266,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut $nexY = $pdf->GetY(); - // TVA + // VAT Rate if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs); @@ -425,12 +425,12 @@ class pdf_crabe extends ModelePDFFactures /** - * \brief Affiche tableau des versement - * \param pdf Objet PDF - * \param fac Objet facture - * \param posy Position y in PDF - * \param outputlangs Object langs for output - * \return int <0 if KO, >0 if OK + * Show payments table + * @param pdf Object PDF + * @param object Object invoice + * @param posy Position y in PDF + * @param outputlangs Object langs for output + * @return int <0 if KO, >0 if OK */ function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { @@ -940,7 +940,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->SetXY ($this->posxup-1, $tab_top+1); - $pdf->MultiCell(20,2, $outputlangs->transnoentities("PriceUHT"),'','C'); + $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->SetXY ($this->posxqty-1, $tab_top+1); @@ -950,7 +950,7 @@ class pdf_crabe extends ModelePDFFactures if ($this->atleastonediscount) { $pdf->SetXY ($this->posxdiscount-1, $tab_top+1); - $pdf->MultiCell(14,2, $outputlangs->transnoentities("ReductionShort"),'','C'); + $pdf->MultiCell($this->postotalht-$this->posxdiscount,2, $outputlangs->transnoentities("ReductionShort"),'','C'); } if ($this->atleastonediscount) @@ -958,7 +958,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); } $pdf->SetXY ($this->postotalht-1, $tab_top+1); - $pdf->MultiCell(28,2, $outputlangs->transnoentities("TotalHT"),'','C'); + $pdf->MultiCell(26,2, $outputlangs->transnoentities("TotalHT"),'','C'); } diff --git a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 97997f6e42b..8f5cf60df6a 100755 --- a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -80,13 +80,15 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Defini position des colonnes $this->posxdesc=$this->marge_gauche+1; - $this->posxtva=121; - $this->posxup=132; - $this->posxqty=151; + $this->posxtva=113; + $this->posxup=126; + $this->posxqty=145; $this->posxdiscount=162; - $this->postotalht=177; + $this->postotalht=174; $this->tva=array(); + $this->localtax1=array(); + $this->localtax2=array(); $this->atleastoneratenotnull=0; $this->atleastonediscount=0; } @@ -116,7 +118,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if ($conf->fournisseur->dir_output.'/facture') { + $object->fetch_thirdparty(); + $deja_regle = $object->getSommePaiement(); + //$amount_credit_notes_included = $object->getSumCreditNotesUsed(); + //$amount_deposits_included = $object->getSumDepositsUsed(); // Definition de $dir et $file if ($object->specimen) @@ -237,29 +243,33 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut $nexY = $pdf->GetY(); - // TVA - $pdf->SetXY ($this->posxtva, $curY); - $pdf->MultiCell(10, 3, ($object->lines[$i]->tva_tx < 0 ? '*':'').abs($object->lines[$i]->tva_tx), 0, 'R'); + // VAT rate + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) + { + $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs); + $pdf->SetXY ($this->posxtva, $curY); + $pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R'); + } // Unit price before discount $pdf->SetXY ($this->posxup, $curY); - $pdf->MultiCell(20, 3, price($object->lines[$i]->pu_ht), 0, 'R', 0); + $pdf->MultiCell($this->posxqty-$this->posxup-1, 3, price($object->lines[$i]->pu_ht), 0, 'R', 0); // Quantity $pdf->SetXY ($this->posxqty, $curY); - $pdf->MultiCell(10, 3, $object->lines[$i]->qty, 0, 'R'); + $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 3, $object->lines[$i]->qty, 0, 'R'); // Discount on line $pdf->SetXY ($this->posxdiscount, $curY); if ($object->lines[$i]->remise_percent) { - $pdf->MultiCell(14, 3, $object->lines[$i]->remise_percent."%", 0, 'R'); + $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $object->lines[$i]->remise_percent."%", 0, 'R'); } // Total HT line - $pdf->SetXY ($this->postotalht, $curY); - $total = price($object->lines[$i]->total_ht); - $pdf->MultiCell(23, 3, $total, 0, 'R', 0); + $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs); + $pdf->SetXY ($this->postotalht, $curY); + $pdf->MultiCell(26, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $tvaligne=$object->lines[$i]->total_tva; @@ -319,30 +329,15 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1; } + // Affiche zone totaux $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); - if ($deja_regle) + if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) { - $this->_tableau_versements($pdf, $object, $posy, $outputlangs); + $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); } - /* - * Payment mode - */ - /* Hidden for supplier invoices - if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER)) - { - $pdf->SetXY ($this->marge_gauche, 228); - $pdf->SetTextColor(200,0,0); - $pdf->SetFont('','B', $default_font_size - 2); - $pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0); - $pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorCreateBankAccount"),0,'L',0); - $pdf->SetTextColor(0,0,0); - }*/ - - /* - * Pied de page - */ + // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); $pdf->AliasNbPages(); @@ -378,14 +373,13 @@ class pdf_canelle extends ModelePDFSuppliersInvoices */ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { - $tab2_top = $posy; - $tab2_hl = 4; + $default_font_size = pdf_getPDFFontSize($outputlangs); - $default_font_size = pdf_getPDFFontSize($outputlangs); + $tab2_top = $posy; + $tab2_hl = 4; $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY ($this->marge_gauche, $tab2_top + 0); - // If France, show VAT mention if not applicable if ($this->emetteur->pays_code == 'FR' && $this->franchise == 1) { @@ -393,38 +387,15 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } // Tableau total - $lltot = 200; $col1x = 120; $col2x = 182; $largcol2 = $lltot - $col2x; + $lltot = 200; $col1x = 120; $col2x = 170; $largcol2 = $lltot - $col2x; // Total HT $pdf->SetFillColor(255,255,255); $pdf->SetXY ($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $pdf->SetXY ($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1); - // Remise globale - if ($object->remise > 0) - { - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("GlobalDiscount"), 0, 'L', 1); - - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl); - $pdf->MultiCell($largcol2, $tab2_hl, "-".$object->remise_percent."%", 0, 'R', 1); - - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * 2); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, "Total HT apres remise", 0, 'L', 1); - - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * 2); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht), 0, 'R', 0); - - $index = 2; - } - else - { - $index = 0; - } - // Affichage des totaux de TVA par taux (conformement a reglementation) $pdf->SetFillColor(248,248,248); @@ -502,8 +473,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } /** - * \brief Show the lines of invoice - * \param pdf object PDF + * Show the lines of invoice + * @param pdf object PDF */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -511,7 +482,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $default_font_size = pdf_getPDFFontSize($outputlangs); - // Montants exprimes en (en tab_top - 1 + // Amount in (at tab_top - 1) $pdf->SetTextColor(0,0,0); $pdf->SetFont('','',$default_font_size - 2); $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->monnaie)); @@ -530,23 +501,26 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetXY ($this->posxdesc-1, $tab_top+2); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); - $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); - $pdf->SetXY ($this->posxtva-1, $tab_top+2); - $pdf->MultiCell(12,2, $outputlangs->transnoentities("VAT"),'','C'); + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) + { + $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); + $pdf->SetXY ($this->posxtva-1, $tab_top+2); + $pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C'); + } $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->SetXY ($this->posxup-1, $tab_top+2); - $pdf->MultiCell(18,2, $outputlangs->transnoentities("PriceUHT"),'','C'); + $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->SetXY ($this->posxqty-1, $tab_top+2); - $pdf->MultiCell(11,2, $outputlangs->transnoentities("Qty"),'','C'); + $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); if ($this->atleastonediscount) { $pdf->SetXY ($this->posxdiscount-1, $tab_top+2); - $pdf->MultiCell(16,2, $outputlangs->transnoentities("ReductionShort"),'','C'); + $pdf->MultiCell($this->postotalht-$this->posxdiscount,2, $outputlangs->transnoentities("ReductionShort"),'','C'); } if ($this->atleastonediscount) @@ -554,17 +528,17 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); } $pdf->SetXY ($this->postotalht-1, $tab_top+2); - $pdf->MultiCell(23,2, $outputlangs->transnoentities("TotalHTShort"),'','C'); + $pdf->MultiCell(26,2, $outputlangs->transnoentities("TotalHTShort"),'','C'); } /** - * \brief Show payments table - * \param pdf Object PDF - * \param fac Object facture - * \param posy Position y in PDF - * \param outputlangs Object langs for output - * \return int <0 if KO, >0 if OK + * Show payments table + * @param pdf Object PDF + * @param object Object invoice + * @param posy Position y in PDF + * @param outputlangs Object langs for output + * @return int <0 if KO, >0 if OK */ function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { @@ -573,6 +547,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tab3_width = 80; $tab3_height = 4; + $default_font_size = pdf_getPDFFontSize($outputlangs); + $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY ($tab3_posx, $tab3_top - 5); $pdf->MultiCell(60, 5, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0); @@ -603,10 +579,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $resql=$this->db->query($sql); if ($resql) { - $num = $this->db->num_rows($resql); + $num = $this->db->num_rows($resql); $i=0; while ($i < $num) { - $y+=3; + $y+=3; $row = $this->db->fetch_object($resql); $pdf->SetXY ($tab3_posx, $tab3_top+$y ); diff --git a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php index 0a6fa0748bb..e2bd33c597b 100644 --- a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -80,14 +80,16 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Defini position des colonnes $this->posxdesc=$this->marge_gauche+1; - $this->posxtva=121; - $this->posxup=132; - $this->posxqty=151; + $this->posxtva=113; + $this->posxup=126; + $this->posxqty=145; $this->posxdiscount=162; - $this->postotalht=177; + $this->postotalht=174; $this->tva=array(); - $this->atleastoneratenotnull=0; + $this->localtax1=array(); + $this->localtax2=array(); + $this->atleastoneratenotnull=0; $this->atleastonediscount=0; } @@ -117,7 +119,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ($conf->fournisseur->dir_output.'/commande') { + $object->fetch_thirdparty(); + $deja_regle = ""; + //$amount_credit_notes_included = $object->getSumCreditNotesUsed(); + //$amount_deposits_included = $object->getSumDepositsUsed(); // Definition de $dir et $file if ($object->specimen) @@ -247,29 +253,33 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut $nexY = $pdf->GetY(); - // TVA - $pdf->SetXY ($this->posxtva, $curY); - $pdf->MultiCell(10, 3, ($object->lines[$i]->tva_tx < 0 ? '*':'').abs($object->lines[$i]->tva_tx), 0, 'R'); + // VAT Rate + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) + { + $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs); + $pdf->SetXY ($this->posxtva, $curY); + $pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R'); + } // Unit price before discount $pdf->SetXY ($this->posxup, $curY); - $pdf->MultiCell(18, 3, price($object->lines[$i]->subprice), 0, 'R', 0); + $pdf->MultiCell($this->posxqty-$this->posxup-1, 3, price($object->lines[$i]->subprice), 0, 'R', 0); // Quantity $pdf->SetXY ($this->posxqty, $curY); - $pdf->MultiCell(10, 3, $object->lines[$i]->qty, 0, 'R'); + $pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 3, $object->lines[$i]->qty, 0, 'R'); // Discount on line $pdf->SetXY ($this->posxdiscount, $curY); if ($object->lines[$i]->remise_percent) { - $pdf->MultiCell(14, 3, $object->lines[$i]->remise_percent."%", 0, 'R'); + $pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $object->lines[$i]->remise_percent."%", 0, 'R'); } // Total HT line + $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs); $pdf->SetXY ($this->postotalht, $curY); - $total = price($object->lines[$i]->total_ht); - $pdf->MultiCell(23, 3, $total, 0, 'R', 0); + $pdf->MultiCell(26, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $tvaligne=$object->lines[$i]->total_tva; @@ -329,31 +339,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1; } + // Affiche zone totaux $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); - if ($deja_regle) + if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) { $this->_tableau_versements($pdf, $fac, $posy); } - /* - * Mode de reglement - */ - /* Not for supplier orders - if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER)) - { - $pdf->SetXY ($this->marge_gauche, 228); - $pdf->SetTextColor(200,0,0); - $pdf->SetFont('','B', $default_font_size - 2); - $pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0); - $pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorCreateBankAccount"),0,'L',0); - $pdf->SetTextColor(0,0,0); - } - */ - - /* - * Pied de page - */ + // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); $pdf->AliasNbPages(); @@ -389,9 +383,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders */ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { - $tab2_top = $posy; + $default_font_size = pdf_getPDFFontSize($outputlangs); + + $tab2_top = $posy; $tab2_hl = 4; - $default_font_size = pdf_getPDFFontSize($outputlangs); $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY ($this->marge_gauche, $tab2_top + 0); @@ -403,7 +398,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } // Tableau total - $lltot = 200; $col1x = 120; $col2x = 182; $largcol2 = $lltot - $col2x; + $lltot = 200; $col1x = 120; $col2x = 170; $largcol2 = $lltot - $col2x; // Total HT $pdf->SetFillColor(255,255,255); @@ -413,28 +408,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY ($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1); - // Remise globale - if ($object->remise > 0) - { - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("GlobalDiscount"), 0, 'L', 1); - - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl); - $pdf->MultiCell($largcol2, $tab2_hl, "-".$object->remise_percent."%", 0, 'R', 1); - - $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * 2); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, "Total HT apres remise", 0, 'L', 1); - - $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * 2); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht), 0, 'R', 0); - - $index = 2; - } - else - { - $index = 0; - } - // Affichage des totaux de TVA par taux (conformement a reglementation) $pdf->SetFillColor(248,248,248); @@ -511,15 +484,17 @@ class pdf_muscadet extends ModelePDFSuppliersOrders return ($tab2_top + ($tab2_hl * $index)); } - /** - * \brief Affiche la grille des lignes de propales - * \param pdf objet PDF - */ + /** + * Show the lines of order + * @param pdf object PDF + */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { global $conf; - // Montants exprimes en (en tab_top - 1 + $default_font_size = pdf_getPDFFontSize($outputlangs); + + // Amount in (at tab_top - 1) $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 2); $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->monnaie)); @@ -538,23 +513,26 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY ($this->posxdesc-1, $tab_top+2); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); - $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); - $pdf->SetXY ($this->posxtva-1, $tab_top+2); - $pdf->MultiCell(12,2, $outputlangs->transnoentities("VAT"),'','C'); + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) + { + $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); + $pdf->SetXY ($this->posxtva-1, $tab_top+2); + $pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C'); + } $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->SetXY ($this->posxup-1, $tab_top+2); - $pdf->MultiCell(18,2, $outputlangs->transnoentities("PriceUHT"),'','C'); + $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->SetXY ($this->posxqty-1, $tab_top+2); - $pdf->MultiCell(11,2, $outputlangs->transnoentities("Qty"),'','C'); + $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); if ($this->atleastonediscount) { $pdf->SetXY ($this->posxdiscount-1, $tab_top+2); - $pdf->MultiCell(16,2, $outputlangs->transnoentities("ReductionShort"),'','C'); + $pdf->MultiCell($this->postotalht-$this->posxdiscount,2, $outputlangs->transnoentities("ReductionShort"),'','C'); } if ($this->atleastonediscount) @@ -562,7 +540,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); } $pdf->SetXY ($this->postotalht-1, $tab_top+2); - $pdf->MultiCell(23,2, $outputlangs->transnoentities("TotalHTShort"),'','C'); + $pdf->MultiCell(26,2, $outputlangs->transnoentities("TotalHTShort"),'','C'); }