Fix: uniformized code

This commit is contained in:
Regis Houssin 2009-12-04 13:30:22 +00:00
parent 9c6b85695b
commit 68c66356da
2 changed files with 249 additions and 253 deletions

View File

@ -1,6 +1,7 @@
<?PHP <?PHP
/* Copyright (C) 2005-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -21,29 +22,30 @@
*/ */
/** /**
\file htdocs/compta/export/ComptaJournalPaiement.php * \file htdocs/compta/export/ComptaJournalPaiement.php
\ingroup compta * \ingroup compta
\brief Fichier de la classe export compta journal * \brief Fichier de la classe export compta journal
\version $Revision$ * \version $Revision$
*/ */
require_once(DOL_DOCUMENT_ROOT.'/compta/export/ComptaJournalPdf.class.php'); require_once(DOL_DOCUMENT_ROOT.'/compta/export/ComptaJournalPdf.class.php');
/** /**
\class ComptaJournalPaiement * \class ComptaJournalPaiement
\brief Classe export compta journal * \brief Classe export compta journal
*/ */
class ComptaJournalPaiement { class ComptaJournalPaiement
{
function ComptaJournalPaiement ($db=0) function ComptaJournalPaiement ($db=0)
{ {
$this->db = $db; $this->db = $db;
} }
function GeneratePdf($user, $dir, $excid, $excref) function GeneratePdf($user, $dir, $excid, $excref)
{ {
global $conf;
$date = strftime("%Y%m",time()); $date = strftime("%Y%m",time());
$file = $dir . "JournalPaiement".$excref . ".pdf"; $file = $dir . "JournalPaiement".$excref . ".pdf";
@ -96,8 +98,8 @@ class ComptaJournalPaiement {
$sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND p.statut = 1 "; $sql.= " AND p.statut = 1 ";
$sql.= " AND pf.fk_facture = f.rowid"; $sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND p.fk_export_compta = ".$excid; $sql.= " AND p.fk_export_compta = ".$excid;
$sql.= " ORDER BY date_format(p.datep,'%Y%m%d') ASC, s.nom ASC"; $sql.= " ORDER BY date_format(p.datep,'%Y%m%d') ASC, s.nom ASC";
$oldate = ''; $oldate = '';
@ -118,7 +120,6 @@ class ComptaJournalPaiement {
if ($oldate <> strftime("%d%m%Y",$obj->dp)) if ($oldate <> strftime("%d%m%Y",$obj->dp))
{ {
if ($oldate <> '') if ($oldate <> '')
{ {
$this->pdf->SetFont('Arial','B',9); $this->pdf->SetFont('Arial','B',9);
@ -147,13 +148,13 @@ class ComptaJournalPaiement {
$this->pdf->cell(20,$this->hligne,'Tiers'); $this->pdf->cell(20,$this->hligne,'Tiers');
$this->pdf->cell(87,$this->hligne,'Libellé'); $this->pdf->cell(87,$this->hligne,'Libelle');
$this->pdf->cell(16,$this->hligne,'Echeance',0,0,'R'); $this->pdf->cell(16,$this->hligne,'Echeance',0,0,'R');
$this->pdf->cell(18,$this->hligne,'Débit',0,0,'R'); $this->pdf->cell(18,$this->hligne,'Debit',0,0,'R');
$this->pdf->cell(18,$this->hligne,'Crédit',0,0,'R'); $this->pdf->cell(18,$this->hligne,'Credit',0,0,'R');
$this->pdf->ln(); $this->pdf->ln();
$oldate = strftime("%d%m%Y",$obj->dp); $oldate = strftime("%d%m%Y",$obj->dp);
@ -185,7 +186,7 @@ class ComptaJournalPaiement {
$debit = ''; $debit = '';
$total_credit = $total_credit + $credit; $total_credit = $total_credit + $credit;
$grand_total_credit = $grand_total_credit + $credit; $grand_total_credit = $grand_total_credit + $credit;
$libelle = "Rejet Prélèvement"; $libelle = "Rejet Prelevement";
} }
$s = $socnom . ' '.$libelle; $s = $socnom . ' '.$libelle;
@ -196,7 +197,6 @@ class ComptaJournalPaiement {
$facnumber = $obj->increment; $facnumber = $obj->increment;
} }
$this->_print_ligne($obj->dp, $facnumber, '41100000', $s, $credit, $debit); $this->_print_ligne($obj->dp, $facnumber, '41100000', $s, $credit, $debit);
if ($obj->amount >= 0) if ($obj->amount >= 0)
@ -214,7 +214,6 @@ class ComptaJournalPaiement {
$grand_total_debit = $grand_total_debit + $debit; $grand_total_debit = $grand_total_debit + $debit;
} }
$s = $socnom . ' '.$libelle; $s = $socnom . ' '.$libelle;
$this->_print_ligne($obj->dp, $facnumber, '5122000', $s, $credit, $debit); $this->_print_ligne($obj->dp, $facnumber, '5122000', $s, $credit, $debit);
@ -229,6 +228,7 @@ class ComptaJournalPaiement {
$this->pdf->cell(18,$this->hligne,$total_debit,0,0,'R'); $this->pdf->cell(18,$this->hligne,$total_debit,0,0,'R');
$this->pdf->cell(18,$this->hligne,$total_credit,0,0,'R'); $this->pdf->cell(18,$this->hligne,$total_credit,0,0,'R');
$this->pdf->ln(); $this->pdf->ln();
/* /*
* *
*/ */
@ -240,7 +240,6 @@ class ComptaJournalPaiement {
$this->pdf->ln(); $this->pdf->ln();
/* /*
*
* *
*/ */
@ -248,7 +247,6 @@ class ComptaJournalPaiement {
$this->pdf->Output($file); $this->pdf->Output($file);
return 1; return 1;
} }
else else
@ -259,13 +257,12 @@ class ComptaJournalPaiement {
} }
else else
{ {
$this->error="Erreur: FAC_OUTPUTDIR non défini !"; $this->error=$langs->trans("ErrorConstantNotDefined","FAC_OUTPUTDIR");
return 0; return 0;
} }
} }
/* /*
*
*
* *
*/ */
Function _print_ligne($a, $b, $c, $d, $e, $f) Function _print_ligne($a, $b, $c, $d, $e, $f)
@ -278,7 +275,6 @@ class ComptaJournalPaiement {
$this->pdf->cell(18,$this->hligne, $e,0,0,'R'); $this->pdf->cell(18,$this->hligne, $e,0,0,'R');
$this->pdf->cell(18,$this->hligne, $f,0,0,'R'); $this->pdf->cell(18,$this->hligne, $f,0,0,'R');
$this->pdf->ln(); $this->pdf->ln();
} }
} }

View File

@ -375,7 +375,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
} }
else else
{ {
$this->error=$langs->trans("ErrorConstantNotDefined","PROP_OUTPUTDIR"); $this->error=$langs->trans("ErrorConstantNotDefined","SUPPLIER_OUTPUTDIR");
return 0; return 0;
} }
$this->error=$langs->trans("ErrorUnknown"); $this->error=$langs->trans("ErrorUnknown");