2
0
forked from Wavyzz/dolibarr

Fix: Les modle PDF ne graient pas l'affichage de l'avoir appliqu sur une facture.

This commit is contained in:
Laurent Destailleur
2007-12-16 19:07:41 +00:00
parent c198cddf0f
commit c89ff96964
9 changed files with 500 additions and 409 deletions

View File

@@ -389,10 +389,12 @@ while (($file = readdir($handle))!==false)
$htmltooltip.='<br><b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br><b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br><b>'.$langs->trans("Height").'/'.$langs->trans("Width").'</b>: '.$module->page_hauteur.'/'.$module->page_largeur; $htmltooltip.='<br><b>'.$langs->trans("Height").'/'.$langs->trans("Width").'</b>: '.$module->page_hauteur.'/'.$module->page_largeur;
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo); $htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo,1,1);
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg); $htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg,1,1);
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg); $htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg,1,1);
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>: '.yn($module->option_multilang); $htmltooltip.='<br><b>'.$langs->trans("Escompte").'</b>: '.yn($module->option_escompte,1,1);
$htmltooltip.='<br><b>'.$langs->trans("CreditNote").'</b>: '.yn($module->option_credit_note,1,1);
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>: '.yn($module->option_multilang,1,1);
print '<td align="center">'; print '<td align="center">';
print $html->textwithhelp('',$htmltooltip,1,0); print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>'; print '</td>';

View File

@@ -2094,8 +2094,8 @@ else
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr><td colspan="2" align="right">'.$langs->trans("CreditNote").' ';
$invoice->fetch($obj->fk_facture_source); $invoice->fetch($obj->fk_facture_source);
print '<tr><td colspan="2" align="right">'.$langs->trans("CreditNote").' ';
print $invoice->getNomUrl(0); print $invoice->getNomUrl(0);
print ' :</td>'; print ' :</td>';
print '<td align="right" style="border: 1px solid;">'.price($obj->amount_ttc).'</td>'; print '<td align="right" style="border: 1px solid;">'.price($obj->amount_ttc).'</td>';

View File

@@ -134,7 +134,7 @@ class MenuLeft {
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/perms.php", $langs->trans("Security")); if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/perms.php", $langs->trans("Security"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/mails.php", $langs->trans("EMails")); if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/mails.php", $langs->trans("EMails"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/limits.php", $langs->trans("Limits")); if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/limits.php", $langs->trans("MenuLimits"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/dict.php", $langs->trans("DictionnarySetup")); if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/dict.php", $langs->trans("DictionnarySetup"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/const.php", $langs->trans("OtherSetup")); if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/const.php", $langs->trans("OtherSetup"));

View File

@@ -126,6 +126,7 @@ class pdf_crabe extends ModelePDFFactures
} }
$deja_regle = $fac->getSommePaiement(); $deja_regle = $fac->getSommePaiement();
$amount_credit_not_included = $fac->getSommeCreditNote();
// D<>finition de $dir et $file // D<>finition de $dir et $file
if ($fac->specimen) if ($fac->specimen)
@@ -366,7 +367,8 @@ class pdf_crabe extends ModelePDFFactures
$posy=$this->_tableau_tot($pdf, $fac, $deja_regle, $bottomlasttab, $outputlangs); $posy=$this->_tableau_tot($pdf, $fac, $deja_regle, $bottomlasttab, $outputlangs);
// Affiche zone versements // Affiche zone versements
if ($deja_regle) { if ($deja_regle || $amount_credit_not_included)
{
$posy=$this->_tableau_versements($pdf, $fac, $posy, $outputlangs); $posy=$this->_tableau_versements($pdf, $fac, $posy, $outputlangs);
} }
@@ -400,10 +402,13 @@ class pdf_crabe extends ModelePDFFactures
} }
/* /**
* \brief Affiche tableau des versement * \brief Affiche tableau des versement
* \param pdf objet PDF * \param pdf Objet PDF
* \param fac objet facture * \param fac Objet facture
* \param posy Position y in PDF
* \param outputlangs Object langs for output
* \return int <0 if KO, >0 if OK
*/ */
function _tableau_versements(&$pdf, $fac, $posy, $outputlangs) function _tableau_versements(&$pdf, $fac, $posy, $outputlangs)
{ {
@@ -427,23 +432,66 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY ($tab3_posx+60, $tab3_top-1 ); $pdf->SetXY ($tab3_posx+60, $tab3_top-1 );
$pdf->MultiCell(20, 4, $outputlangs->transnoentities("Num"), 0, 'L', 0); $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Num"), 0, 'L', 0);
$y=0;
// Loop on each credit note included
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
$sql.= " re.description, re.fk_facture_source, re.fk_facture_source";
$sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re";
$sql.= " WHERE fk_facture = ".$fac->id;
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i=0;
$invoice=new Facture($this->db);
while ($i < $num)
{
$y+=3;
$obj = $this->db->fetch_object($resql);
$invoice->fetch($obj->fk_facture_source);
$pdf->SetXY ($tab3_posx, $tab3_top+$y );
$pdf->MultiCell(20, 4,'', 0, 'L', 0);
$pdf->SetXY ($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 4, price($obj->amount_ttc), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+41, $tab3_top+$y);
$pdf->MultiCell(20, 4, $outputlangs->trans("CreditNote"), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+60, $tab3_top+$y);
$pdf->MultiCell(20, 4, $invoice->ref, 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 );
$i++;
}
}
else
{
$this->error=$outputlangs->trans("ErrorSQL")." sql=".$sql;
dolibarr_syslog($this->db,$this->error);
return -1;
}
// Loop on each payment
$sql = "SELECT ".$this->db->pdate("p.datep")."as date, pf.amount as amount, p.fk_paiement as type, p.num_paiement as num "; $sql = "SELECT ".$this->db->pdate("p.datep")."as date, pf.amount as amount, p.fk_paiement as type, p.num_paiement as num ";
$sql.= "FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."paiement_facture as pf "; $sql.= "FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."paiement_facture as pf ";
$sql.= "WHERE pf.fk_paiement = p.rowid and pf.fk_facture = ".$fac->id." "; $sql.= "WHERE pf.fk_paiement = p.rowid and pf.fk_facture = ".$fac->id." ";
$sql.= "ORDER BY p.datep"; $sql.= "ORDER BY p.datep";
if ($this->db->query($sql)) $resql=$this->db->query($sql);
if ($resql)
{ {
$pdf->SetFont('Arial','',6); $pdf->SetFont('Arial','',6);
$num = $this->db->num_rows(); $num = $this->db->num_rows($resql);
$i=0; $y=0; $i=0;
while ($i < $num) { while ($i < $num) {
$y+=3; $y+=3;
$row = $this->db->fetch_row(); $row = $this->db->fetch_row($resql);
$pdf->SetXY ($tab3_posx, $tab3_top+$y ); $pdf->SetXY ($tab3_posx, $tab3_top+$y );
$pdf->MultiCell(20, 4, dolibarr_print_date($row[0],'day'), 0, 'L', 0); $pdf->MultiCell(20, 4, dolibarr_print_date($row[0],'day'), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+21, $tab3_top+$y); $pdf->SetXY ($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 4, $row[1], 0, 'L', 0); $pdf->MultiCell(20, 4, price($row[1]), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+41, $tab3_top+$y); $pdf->SetXY ($tab3_posx+41, $tab3_top+$y);
switch ($row[2]) switch ($row[2])
{ {

View File

@@ -18,7 +18,6 @@
* or see http://www.gnu.org/ * or see http://www.gnu.org/
* *
* $Id$ * $Id$
* $Source$
*/ */
/** /**
@@ -64,7 +63,14 @@ class pdf_huitre extends ModelePDFFactures
$this->page_hauteur = 297; $this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->option_logo = 1; // Affiche logo $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 0; // Gere choix mode r<>glement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
$this->option_condreg = 1; // Affiche conditions r<>glement
$this->option_codeproduitservice = 0; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 0; // G<>re les avoirs
// Recupere emmetteur // Recupere emmetteur
$this->emetteur=$mysoc; $this->emetteur=$mysoc;

View File

@@ -67,7 +67,12 @@ class pdf_oursin extends ModelePDFFactures
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 1; // Gere choix mode r<>glement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER $this->option_modereg = 1; // Gere choix mode r<>glement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
$this->option_codeproduitservice = 1; // Affiche code produit-service FACTURE_CODEPRODUITSERVICE $this->option_condreg = 1; // Affiche conditions r<>glement
$this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 1; // G<>re les avoirs
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1; $this->franchise=1;
@@ -79,22 +84,8 @@ class pdf_oursin extends ModelePDFFactures
/** /**
* \brief Fonction g<>n<EFBFBD>rant la facture sur le disque * \brief Fonction g<>n<EFBFBD>rant la facture sur le disque
* \param facid id de la facture <20> g<>n<EFBFBD>rer * \param fac Objet facture <20> g<>n<EFBFBD>rer (ou id si ancienne methode)
* \return int 1=ok, 0=ko * \return int 1=ok, 0=ko
* \remarks Variables utilis<69>es
* \remarks MAIN_INFO_SOCIETE_NOM
* \remarks MAIN_INFO_SOCIETE_ADRESSE
* \remarks MAIN_INFO_SOCIETE_CP
* \remarks MAIN_INFO_SOCIETE_VILLE
* \remarks MAIN_INFO_SOCIETE_TEL
* \remarks MAIN_INFO_SOCIETE_FAX
* \remarks MAIN_INFO_SOCIETE_WEB
* \remarks MAIN_INFO_SOCIETE_LOGO
* \remarks MAIN_INFO_SIRET
* \remarks MAIN_INFO_SIREN
* \remarks MAIN_INFO_RCS
* \remarks MAIN_INFO_CAPITAL
* \remarks MAIN_INFO_TVAINTRA
*/ */
function write_file($fac,$outputlangs='') function write_file($fac,$outputlangs='')
{ {
@@ -108,10 +99,6 @@ class pdf_oursin extends ModelePDFFactures
$outputlangs->setPhpLang(); $outputlangs->setPhpLang();
$langs->load("main");
$langs->load("bills");
$langs->load("products");
if ($conf->facture->dir_output) if ($conf->facture->dir_output)
{ {
// D<>finition de l'objet $fac (pour compatibilite ascendante) // D<>finition de l'objet $fac (pour compatibilite ascendante)
@@ -122,6 +109,10 @@ class pdf_oursin extends ModelePDFFactures
$ret=$fac->fetch($id); $ret=$fac->fetch($id);
} }
$deja_regle = $fac->getSommePaiement();
$amount_credit_not_included = $fac->getSommeCreditNote();
// D<>finition de $dir et $file // D<>finition de $dir et $file
if ($fac->specimen) if ($fac->specimen)
{ {
@@ -168,7 +159,7 @@ class pdf_oursin extends ModelePDFFactures
$this->_pagehead($pdf, $fac); $this->_pagehead($pdf, $fac);
$pdf->SetTitle($fac->ref); $pdf->SetTitle($fac->ref);
$pdf->SetSubject($langs->transnoentities("Invoice")); $pdf->SetSubject($outputlangs->transnoentities("Invoice"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetAuthor($user->fullname);
@@ -202,12 +193,12 @@ class pdf_oursin extends ModelePDFFactures
$prodser->fetch($fac->lignes[$i]->produit_id); $prodser->fetch($fac->lignes[$i]->produit_id);
if ($prodser->ref) { if ($prodser->ref) {
$codeproduitservice=" - ".$langs->transnoentities("ProductCode")." ".$prodser->ref; $codeproduitservice=" - ".$outputlangs->transnoentities("ProductCode")." ".$prodser->ref;
} }
} }
if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end) { if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end) {
// Affichage dur<75>e si il y en a une // Affichage dur<75>e si il y en a une
$codeproduitservice.=" (".$langs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start)." ".$langs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end).")"; $codeproduitservice.=" (".$outputlangs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start)." ".$langs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end).")";
} }
$pdf->MultiCell(108, 5, $fac->lignes[$i]->desc."$codeproduitservice", 0, 'J'); $pdf->MultiCell(108, 5, $fac->lignes[$i]->desc."$codeproduitservice", 0, 'J');
@@ -250,31 +241,27 @@ class pdf_oursin extends ModelePDFFactures
} }
} }
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $fac); $posy=$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $fac);
$deja_regle = $fac->getSommePaiement(); $posy=$this->_tableau_tot($pdf, $fac, $deja_regle);
$this->_tableau_tot($pdf, $fac, $deja_regle); // Affiche zone versements
if ($deja_regle || $amount_credit_not_included)
if ($deja_regle) { {
$this->_tableau_versements($pdf, $fac); $posy=$this->_tableau_versements($pdf, $fac, $posy, $outputlangs);
} }
/* // Mode de r<>glement
* Mode de r<>glement
*/
if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER)) { if ((! defined("FACTURE_CHQ_NUMBER") || ! FACTURE_CHQ_NUMBER) && (! defined("FACTURE_RIB_NUMBER") || ! FACTURE_RIB_NUMBER)) {
$pdf->SetXY ($this->marges['g'], 228); $pdf->SetXY ($this->marges['g'], 228);
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
$pdf->MultiCell(90, 3, $langs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0); $pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0);
$pdf->MultiCell(90, 3, $langs->transnoentities("ErrorCreateBankAccount"),0,'L',0); $pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorCreateBankAccount"),0,'L',0);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }
/* // Propose mode r<>glement par CHQ
* Propose mode r<>glement par CHQ
*/
if (defined("FACTURE_CHQ_NUMBER")) if (defined("FACTURE_CHQ_NUMBER"))
{ {
if (FACTURE_CHQ_NUMBER > 0) if (FACTURE_CHQ_NUMBER > 0)
@@ -284,16 +271,14 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetXY ($this->marges['g'], 225); $pdf->SetXY ($this->marges['g'], 225);
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
$pdf->MultiCell(90, 3, $langs->transnoentities('PaymentByChequeOrderedTo').' '.$account->proprio.' '.$langs->transnoentities('SendTo').':',0,'L',0); $pdf->MultiCell(90, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo').' '.$account->proprio.' '.$langs->transnoentities('SendTo').':',0,'L',0);
$pdf->SetXY ($this->marges['g'], 230); $pdf->SetXY ($this->marges['g'], 230);
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0); $pdf->MultiCell(80, 3, $account->adresse_proprio, 0, 'L', 0);
} }
} }
/* // Propose mode r<>glement par RIB
* Propose mode r<>glement par RIB
*/
if (defined("FACTURE_RIB_NUMBER")) if (defined("FACTURE_RIB_NUMBER"))
{ {
if (FACTURE_RIB_NUMBER > 0) if (FACTURE_RIB_NUMBER > 0)
@@ -304,21 +289,21 @@ class pdf_oursin extends ModelePDFFactures
$cury=240; $cury=240;
$pdf->SetXY ($this->marges['g'], $cury); $pdf->SetXY ($this->marges['g'], $cury);
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
$pdf->MultiCell(90, 3, $langs->transnoentities('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0); $pdf->MultiCell(90, 3, $outputlangs->transnoentities('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0);
$cury=245; $cury=245;
$pdf->SetFont('Arial','B',6); $pdf->SetFont('Arial','B',6);
$pdf->line($this->marges['g'], $cury, $this->marges['g'], $cury+10 ); $pdf->line($this->marges['g'], $cury, $this->marges['g'], $cury+10 );
$pdf->SetXY ($this->marges['g'], $cury); $pdf->SetXY ($this->marges['g'], $cury);
$pdf->MultiCell(18, 3, $langs->transnoentities("BankCode"), 0, 'C', 0); $pdf->MultiCell(18, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
$pdf->line($this->marges['g']+18, $cury, $this->marges['g']+18, $cury+10 ); $pdf->line($this->marges['g']+18, $cury, $this->marges['g']+18, $cury+10 );
$pdf->SetXY ($this->marges['g']+18, $cury); $pdf->SetXY ($this->marges['g']+18, $cury);
$pdf->MultiCell(18, 3, $langs->transnoentities("DeskCode"), 0, 'C', 0); $pdf->MultiCell(18, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
$pdf->line($this->marges['g']+36, $cury, $this->marges['g']+36, $cury+10 ); $pdf->line($this->marges['g']+36, $cury, $this->marges['g']+36, $cury+10 );
$pdf->SetXY ($this->marges['g']+36, $cury); $pdf->SetXY ($this->marges['g']+36, $cury);
$pdf->MultiCell(24, 3, $langs->transnoentities("BankAccountNumber"), 0, 'C', 0); $pdf->MultiCell(24, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
$pdf->line($this->marges['g']+60, $cury, $this->marges['g']+60, $cury+10 ); $pdf->line($this->marges['g']+60, $cury, $this->marges['g']+60, $cury+10 );
$pdf->SetXY ($this->marges['g']+60, $cury); $pdf->SetXY ($this->marges['g']+60, $cury);
$pdf->MultiCell(13, 3, $langs->transnoentities("BankAccountNumberKey"), 0, 'C', 0); $pdf->MultiCell(13, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
$pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 ); $pdf->line($this->marges['g']+73, $cury, $this->marges['g']+73, $cury+10 );
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
@@ -332,32 +317,28 @@ class pdf_oursin extends ModelePDFFactures
$pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0); $pdf->MultiCell(13, 3, $account->cle_rib, 0, 'C', 0);
$pdf->SetXY ($this->marges['g'], $cury+15); $pdf->SetXY ($this->marges['g'], $cury+15);
$pdf->MultiCell(90, 3, $langs->transnoentities("Residence").' : ' . $account->domiciliation, 0, 'L', 0); $pdf->MultiCell(90, 3, $outputlangs->transnoentities("Residence").' : ' . $account->domiciliation, 0, 'L', 0);
$pdf->SetXY ($this->marges['g'], $cury+25); $pdf->SetXY ($this->marges['g'], $cury+25);
$pdf->MultiCell(90, 3, $langs->transnoentities("IbanPrefix").' : ' . $account->iban_prefix, 0, 'L', 0); $pdf->MultiCell(90, 3, $outputlangs->transnoentities("IbanPrefix").' : ' . $account->iban_prefix, 0, 'L', 0);
$pdf->SetXY ($this->marges['g'], $cury+30); $pdf->SetXY ($this->marges['g'], $cury+30);
$pdf->MultiCell(90, 3, $langs->transnoentities("BIC").' : ' . $account->bic, 0, 'L', 0); $pdf->MultiCell(90, 3, $outputlangs->transnoentities("BIC").' : ' . $account->bic, 0, 'L', 0);
} }
} }
/* // Conditions de r<>glements
* Conditions de r<>glements
*/
if ($fac->cond_reglement_code) if ($fac->cond_reglement_code)
{ {
$pdf->SetFont('Arial','B',10); $pdf->SetFont('Arial','B',10);
$pdf->SetXY($this->marges['g'], 217); $pdf->SetXY($this->marges['g'], 217);
$titre = $langs->transnoentities("PaymentConditions").':'; $titre = $outputlangs->transnoentities("PaymentConditions").':';
$pdf->MultiCell(80, 5, $titre, 0, 'L'); $pdf->MultiCell(80, 5, $titre, 0, 'L');
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->SetXY($this->marges['g']+44, 217); $pdf->SetXY($this->marges['g']+44, 217);
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code):$fac->cond_reglement; $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code)!=('PaymentCondition'.$fac->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code):$fac->cond_reglement;
$pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L');
} }
/* // Pied de page
* Pied de page
*/
$this->_pagefoot($pdf, $fac); $this->_pagefoot($pdf, $fac);
$pdf->AliasNbPages(); $pdf->AliasNbPages();
@@ -387,17 +368,16 @@ class pdf_oursin extends ModelePDFFactures
} }
/* /**
* \brief Affiche tableau des versement * \brief Affiche tableau des versement
* \param pdf objet PDF * \param pdf Objet PDF
* \param fac objet facture * \param fac Objet facture
* \param posy Position y in PDF
* \param outputlangs Object langs for output
* \return int <0 if KO, >0 if OK
*/ */
function _tableau_versements(&$pdf, $fac) function _tableau_versements(&$pdf, $fac, $posy, $outputlangs)
{ {
global $langs;
$langs->load("main");
$langs->load("bills");
$tab3_posx = $this->marges['g']+110; $tab3_posx = $this->marges['g']+110;
$tab3_top = $this->marges['h']+235; $tab3_top = $this->marges['h']+235;
$tab3_width = 80; $tab3_width = 80;
@@ -405,36 +385,80 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY ($tab3_posx, $tab3_top - 5); $pdf->SetXY ($tab3_posx, $tab3_top - 5);
$pdf->MultiCell(60, 5, $langs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0); $pdf->MultiCell(60, 5, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0);
$pdf->Rect($tab3_posx, $tab3_top-1, $tab3_width, $tab3_height); $pdf->Rect($tab3_posx, $tab3_top-1, $tab3_width, $tab3_height);
$pdf->SetXY ($tab3_posx, $tab3_top-1 ); $pdf->SetXY ($tab3_posx, $tab3_top-1 );
$pdf->MultiCell(20, 4, $langs->transnoentities("Payment"), 0, 'L', 0); $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+21, $tab3_top-1 ); $pdf->SetXY ($tab3_posx+21, $tab3_top-1 );
$pdf->MultiCell(20, 4, $langs->transnoentities("Amount"), 0, 'L', 0); $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+41, $tab3_top-1 ); $pdf->SetXY ($tab3_posx+41, $tab3_top-1 );
$pdf->MultiCell(20, 4, $langs->transnoentities("Type"), 0, 'L', 0); $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Type"), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+60, $tab3_top-1 ); $pdf->SetXY ($tab3_posx+60, $tab3_top-1 );
$pdf->MultiCell(20, 4, $langs->transnoentities("Ref"), 0, 'L', 0); $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Num"), 0, 'L', 0);
$y=0;
// Loop on each credit note included
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
$sql.= " re.description, re.fk_facture_source, re.fk_facture_source";
$sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re";
$sql.= " WHERE fk_facture = ".$fac->id;
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i=0;
$invoice=new Facture($this->db);
while ($i < $num)
{
$y+=3;
$obj = $this->db->fetch_object($resql);
$invoice->fetch($obj->fk_facture_source);
$pdf->SetXY ($tab3_posx, $tab3_top+$y );
$pdf->MultiCell(20, 4,'', 0, 'L', 0);
$pdf->SetXY ($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 4, price($obj->amount_ttc), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+41, $tab3_top+$y);
$pdf->MultiCell(20, 4, $outputlangs->trans("CreditNote"), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+60, $tab3_top+$y);
$pdf->MultiCell(20, 4, $invoice->ref, 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 );
$i++;
}
}
else
{
$this->error=$outputlangs->trans("ErrorSQL")." sql=".$sql;
dolibarr_syslog($this->db,$this->error);
return -1;
}
// Loop on each payment
$sql = "SELECT ".$this->db->pdate("p.datep")."as date, pf.amount as amount, p.fk_paiement as type, p.num_paiement as num "; $sql = "SELECT ".$this->db->pdate("p.datep")."as date, pf.amount as amount, p.fk_paiement as type, p.num_paiement as num ";
$sql.= "FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."paiement_facture as pf "; $sql.= "FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."paiement_facture as pf ";
$sql.= "WHERE pf.fk_paiement = p.rowid and pf.fk_facture = ".$fac->id." "; $sql.= "WHERE pf.fk_paiement = p.rowid and pf.fk_facture = ".$fac->id." ";
$sql.= "ORDER BY p.datep"; $sql.= "ORDER BY p.datep";
if ($this->db->query($sql)) $resql=$this->db->query($sql);
if ($resql)
{ {
$pdf->SetFont('Arial','',6); $pdf->SetFont('Arial','',6);
$num = $this->db->num_rows(); $num = $this->db->num_rows($resql);
$i=0; $y=0; $i=0;
while ($i < $num) { while ($i < $num)
{
$y+=3; $y+=3;
$row = $this->db->fetch_row(); $row = $this->db->fetch_row($resql);
$pdf->SetXY ($tab3_posx, $tab3_top+$y ); $pdf->SetXY ($tab3_posx, $tab3_top+$y );
$pdf->MultiCell(20, 4, dolibarr_print_date($row[0],'day'), 0, 'L', 0); $pdf->MultiCell(20, 4, dolibarr_print_date($row[0],'day'), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+21, $tab3_top+$y); $pdf->SetXY ($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 4, $row[1], 0, 'L', 0); $pdf->MultiCell(20, 4, price($row[1]), 0, 'L', 0);
$pdf->SetXY ($tab3_posx+41, $tab3_top+$y); $pdf->SetXY ($tab3_posx+41, $tab3_top+$y);
switch ($row[2]) switch ($row[2])
{ {
@@ -471,8 +495,9 @@ class pdf_oursin extends ModelePDFFactures
} }
else else
{ {
$this->error=$langs->transnoentities("ErrorSQL")." $sql"; $this->error=$outputlangs->trans("ErrorSQL")." sql=".$sql;
return 0; dolibarr_syslog($this->db,$this->error);
return -1;
} }
} }

View File

@@ -223,7 +223,7 @@ DiscountAlreadyCounted=Discount already counted
BillAddress=Bill address BillAddress=Bill address
HelpEscompte=This discount is a discount granted to customer because its paiement was made before term. HelpEscompte=This discount is a discount granted to customer because its paiement was made before term.
HelpAbandonBadCustomer=This amount has been abandoned (customer said to be a bad customer) and is considered as an exceptionnal loose. HelpAbandonBadCustomer=This amount has been abandoned (customer said to be a bad customer) and is considered as an exceptionnal loose.
HelpAbandonOther=This amount has been abandoned since it was an error. It must be corrected in accountancy system by creating a credit note. HelpAbandonOther=This amount has been abandoned since it was an error (wrong customer or invoice replaced by an other for example)
InvoiceId=Invoice id InvoiceId=Invoice id
InvoiceRef=Invoice ref. InvoiceRef=Invoice ref.
InvoiceDateCreation=Invoice creation date InvoiceDateCreation=Invoice creation date

View File

@@ -222,7 +222,7 @@ DiscountAlreadyCounted=Remises fixes d
BillAddress=Adresse de facturation BillAddress=Adresse de facturation
HelpEscompte=Un <b>escompte</b> est une remise accord<72>e, sur une facture donn<6E>e, <20> un client car ce dernier a r<>alis<69> son r<>glement bien avant l'<27>ch<63>ance. HelpEscompte=Un <b>escompte</b> est une remise accord<72>e, sur une facture donn<6E>e, <20> un client car ce dernier a r<>alis<69> son r<>glement bien avant l'<27>ch<63>ance.
HelpAbandonBadCustomer=Ce montant a <20>t<EFBFBD> abandonn<6E> (client jug<75> mauvais payeur) et est consid<69>r<EFBFBD> comme un perte exceptionnelle. HelpAbandonBadCustomer=Ce montant a <20>t<EFBFBD> abandonn<6E> (client jug<75> mauvais payeur) et est consid<69>r<EFBFBD> comme un perte exceptionnelle.
HelpAbandonOther=Ce montant a <20>t<EFBFBD> abandonn<6E> car il s'agissait d'un trop r<>clam<61> (oubli de remise ou retour produit du client). Il doit <20>tre r<>gularis<69> en compta par la saisie d'un avoir. HelpAbandonOther=Ce montant a <20>t<EFBFBD> abandonn<6E> car il s'agissait d'une erreur de facturation (saisie mauvais client, facture remplac<61>e par une autre).
InvoiceId=Id facture InvoiceId=Id facture
InvoiceRef=Ref. facture InvoiceRef=Ref. facture
InvoiceDateCreation=Date cr<63>ation facture InvoiceDateCreation=Date cr<63>ation facture

View File

@@ -220,7 +220,7 @@ function dolibarr_syslog($message, $level=LOG_INFO)
fwrite($file,$message."\n"); fwrite($file,$message."\n");
fclose($file); fclose($file);
// If development tag enabled and param log enabled, we show output log on HTML comments // If enable html log tag enabled and url parameter log defined, we show output log on HTML comments
if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"])) if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"]))
{ {
print "\n\n<!-- Log start\n"; print "\n\n<!-- Log start\n";
@@ -2384,16 +2384,26 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $taux_produit)
/** /**
\brief Renvoie oui ou non dans la langue choisie \brief Renvoie oui ou non dans la langue choisie
\param yesno variable pour test si oui ou non \param yesno Variable pour test si oui ou non
\param case Oui/Non ou oui/non \param case 1=Yes/No, 0=yes/no
\param color 0=texte only, 1=Text is format with a color font style
*/ */
function yn($yesno, $case=1) { function yn($yesno, $case=1, $color=0)
{
global $langs; global $langs;
$result='unknown';
if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') // A mettre avant test sur no a cause du == 0 if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') // A mettre avant test sur no a cause du == 0
return $case?$langs->trans("Yes"):$langs->trans("yes"); {
if ($yesno == 0 || strtolower($yesno) == 'no' || strtolower($yesno) == 'false') $result=($case?$langs->trans("Yes"):$langs->trans("yes"));
return $case?$langs->trans("No"):$langs->trans("no"); $class='ok';
return "unknown"; }
elseif ($yesno == 0 || strtolower($yesno) == 'no' || strtolower($yesno) == 'false')
{
$result=($case?$langs->trans("No"):$langs->trans("no"));
$class='error';
}
if ($color) return '<font class="'.$class.'">'.$result.'</font>';
return $result;
} }