Remove deprecated files

This commit is contained in:
Laurent Destailleur 2010-09-01 01:58:24 +00:00
parent 70de76f0fb
commit 3be7cff3d0
8 changed files with 0 additions and 1613 deletions

View File

@ -1,279 +0,0 @@
<?PHP
/* Copyright (C) 2005-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/compta/export/class/ComptaJournalPaiement.class.php
* \ingroup compta
* \brief Fichier de la classe export compta journal
* \version $Id$
*/
require_once(DOL_DOCUMENT_ROOT.'/compta/export/class/ComptaJournalPdf.class.php');
/**
* \class ComptaJournalPaiement
* \brief Classe export compta journal
*/
class ComptaJournalPaiement
{
function ComptaJournalPaiement ($db=0)
{
$this->db = $db;
}
function generatePdf($user, $dir, $excid, $excref)
{
global $conf,$langs;
$date = strftime("%Y%m",time());
$file = $dir . "JournalPaiement".$excref . ".pdf";
$grand_total_debit = 0;
$grand_total_credit = 0;
if (file_exists($dir))
{
$this->pdf = new ComptaJournalPdf('P','mm','A4');
$this->pdf->AliasNbPages();
$this->pdf->Open();
$this->pdf->AddPage();
$this->tab_top = 90;
$this->tab_height = 90;
$this->pdf->SetTitle("Journal des paiements");
$this->pdf->SetCreator("Dolibarr ".DOL_VERSION);
$this->pdf->SetAuthor($user->getFullName($langs));
$this->pdf->SetMargins(10, 10, 10);
$this->pdf->SetAutoPageBreak(1,10);
/*
*
*/
$this->pdf->SetFillColor(220,220,220);
$this->pdf->SetFont('Arial','', 9);
$this->pdf->SetXY (10, 10);
$nexY = $this->pdf->GetY();
$sql = "SELECT p.rowid,p.datep as dp, p.statut";
$sql.= ", pf.amount";
$sql.= ", c.libelle, p.num_paiement";
$sql.= ", f.facnumber, f.increment";
$sql.= ", s.nom";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p";
$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c";
$sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf";
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE p.fk_paiement = c.id";
$sql.= " AND pf.fk_paiement = p.rowid";
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND p.statut = 1 ";
$sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND p.fk_export_compta = ".$excid;
$sql.= " ORDER BY date_format(p.datep,'%Y%m%d') ASC, s.nom ASC";
$oldate = '';
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
$var = True;
$journ = 'CE';
$this->hligne = 5;
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if ($oldate <> strftime("%d%m%Y",$this->db->jdate($obj->dp)))
{
if ($oldate <> '')
{
$this->pdf->SetFont('Arial','B',9);
$this->pdf->cell(143,$this->hligne,'');
$this->pdf->cell(16,$this->hligne,'Total : ',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->ln();
}
$journal = "Journal $journ du ".strftime('%A, %e %B %G',$this->db->jdate($obj->dp));
$total_credit = 0 ;
$total_debit = 0 ;
$this->pdf->SetFont('Arial','B',10);
$this->pdf->cell(10,$this->hligne,"$journal");
$this->pdf->ln();
$this->pdf->SetFont('Arial','',9);
$this->pdf->cell(16,$this->hligne,'Date');
$this->pdf->cell(20,$this->hligne,'N Facture');
$this->pdf->cell(20,$this->hligne,'Tiers');
$this->pdf->cell(87,$this->hligne,'Libelle');
$this->pdf->cell(16,$this->hligne,'Echeance',0,0,'R');
$this->pdf->cell(18,$this->hligne,'Debit',0,0,'R');
$this->pdf->cell(18,$this->hligne,'Credit',0,0,'R');
$this->pdf->ln();
$oldate = strftime("%d%m%Y",$this->db->jdate($obj->dp));
}
/*
*
*/
$socnom = $obj->nom;
$libelle = $obj->libelle;
if (dol_strlen($obj->nom) > 31)
{
$socnom = substr($obj->nom, 0 , 31);
}
$this->pdf->SetFont('Arial','',9);
if ($obj->amount >= 0)
{
$credit = '';
$debit = abs($obj->amount);
$total_debit = $total_debit + $debit;
$grand_total_debit = $grand_total_debit + $debit;
}
else
{
$credit = abs($obj->amount);
$debit = '';
$total_credit = $total_credit + $credit;
$grand_total_credit = $grand_total_credit + $credit;
$libelle = "Rejet Prelevement";
}
$s = $socnom . ' '.$libelle;
$facnumber = $obj->facnumber;
if (dol_strlen(trim($obj->increment)) > 0)
{
$facnumber = $obj->increment;
}
$this->printLine($this->db->jdate($obj->dp), $facnumber, '41100000', $s, $credit, $debit);
if ($obj->amount >= 0)
{
$credit = abs($obj->amount);
$debit = '';
$total_credit = $total_credit + $credit;
$grand_total_credit = $grand_total_credit + $credit;
}
else
{
$credit = '';
$debit = abs($obj->amount);
$total_debit = $total_debit + $debit;
$grand_total_debit = $grand_total_debit + $debit;
}
$s = $socnom . ' '.$libelle;
$this->printLine($this->db->jdate($obj->dp), $facnumber, '5122000', $s, $credit, $debit);
$i++;
}
$this->pdf->SetFont('Arial','B',9);
$this->pdf->cell(143,$this->hligne,'');
$this->pdf->cell(16,$this->hligne,'Total : ',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->ln();
/*
*
*/
$this->pdf->cell(143,$this->hligne,'');
$this->pdf->cell(16,$this->hligne,'Grand Total : ',0,0,'R');
$this->pdf->cell(18,$this->hligne,$grand_total_debit,0,0,'R');
$this->pdf->cell(18,$this->hligne,$grand_total_credit,0,0,'R');
$this->pdf->ln();
/*
*
*/
$this->pdf->Close();
$this->pdf->Output($file);
return 1;
}
else
{
$this->error="";
return 0;
}
}
else
{
$this->error=$langs->trans("ErrorConstantNotDefined","FAC_OUTPUTDIR");
return 0;
}
}
/**
*
*/
function printLine($a, $b, $c, $d, $e, $f)
{
$this->pdf->cell(16,$this->hligne, strftime('%d%m%y',$a));
$this->pdf->cell(20,$this->hligne, $b);
$this->pdf->cell(20,$this->hligne, $c);
$this->pdf->cell(87,$this->hligne, $d);
$this->pdf->cell(16,$this->hligne, strftime('%d%m%y',$a),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->ln();
}
}
?>

View File

@ -1,46 +0,0 @@
<?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/compta/export/class/ComptaJournalPdf.class.php
* \ingroup compta
* \brief Fichier de la classe export compta journal
* \version $Id$
*/
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
/**
* \class ComptaJournalPdf
* \brief Classe export compta journal
*/
class ComptaJournalPdf extends FPDF {
function Footer()
{
$this->SetY(-10);
//Police Arial italique 8
$this->SetFont('Arial','I',8);
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
?>

View File

@ -1,262 +0,0 @@
<?PHP
/* Copyright (C) 2005-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
*/
/**
\file htdocs/compta/export/class/ComptaJournalVente.class.php
\ingroup compta
\brief Fichier de la classe export compta journal
\version $Id$
*/
require_once(DOL_DOCUMENT_ROOT.'/compta/export/class/ComptaJournalPdf.class.php');
/**
\class ComptaJournalVente
\brief Classe export compta journal
*/
class ComptaJournalVente {
function ComptaJournalVente ($db=0)
{
$this->db = $db;
}
function generatePdf($user, $dir, $excid, $excref)
{
global $conf, $langs;
$date = strftime("%Y%m",time());
$file = $dir . "JournalVente".$excref . ".pdf";
if (file_exists($dir))
{
$pdf = new ComptaJournalPdf('P','mm','A4');
$pdf->AliasNbPages();
$pdf->Open();
$pdf->AddPage();
$this->tab_top = 90;
$this->tab_height = 90;
$pdf->SetTitle("Journal des ventes");
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->getFullName($langs));
$pdf->SetMargins(10, 10, 10);
$pdf->SetAutoPageBreak(1,10);
/*
*
*/
$pdf->SetFillColor(220,220,220);
$pdf->SetFont('Arial','', 9);
$pdf->SetXY (10, 10 );
$nexY = $pdf->GetY();
$sql = "SELECT f.rowid as facid, f.facnumber, f.datef as dp";
$sql .= " , f.total_ttc as amount, f.tva";
$sql .= " , s.nom, s.code_compta";
$sql .= " , l.price, l.tva_tx";
$sql .= " , c.numero, f.increment";
$sql .= " , l.rowid as lrowid";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l";
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c";
$sql .= " WHERE f.rowid = l.fk_facture ";
$sql .= " AND s.rowid = f.fk_soc";
$sql .= " AND f.fk_statut = 1 ";
$sql .= " AND l.fk_code_ventilation <> 0 ";
$sql .= " AND l.fk_export_compta <> 0";
$sql .= " AND c.rowid = l.fk_code_ventilation";
$sql .= " AND l.fk_export_compta = ".$excid;
$sql .= " ORDER BY date_format(f.datef,'%Y%m%d') ASC, f.rowid, l.rowid";
$oldate = '';
$oldfac = '';
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
$var = True;
$journ = 'VI';
$hligne = 5;
$wc = array(0,14,6,16,16,90,16,12,4,16);
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if ($oldate <> strftime("%d%m%Y",$this->db->jdate($obj->dp)))
{
$journal = "Journal $journ du ".strftime('%A, %e %B %G',$this->db->jdate($obj->dp));
$total_credit = 0 ;
$total_debit = 0 ;
$pdf->SetFont('Arial','B',10);
$pdf->cell(10,$hligne,"$journal");
$pdf->ln();
$pdf->SetFont('Arial','',9);
$pdf->cell($wc[1],$hligne,'Date');
$pdf->cell($wc[2],$hligne,'');
$pdf->cell($wc[3],$hligne,'Compte');
$pdf->cell($wc[4],$hligne,'Tiers');
$pdf->cell($wc[5],$hligne,'Libell<6C>');
$pdf->cell($wc[6],$hligne,'Facture');
$pdf->cell($wc[7],$hligne,'Montant',0,0,'R');
$pdf->cell($wc[8],$hligne,'');
$pdf->cell($wc[9],$hligne,'Echeance',0,0,'R');
$pdf->ln();
$oldate = strftime("%d%m%Y",$this->db->jdate($obj->dp));
}
/*
*
*/
$socnom = $obj->nom;
$libelle = "Facture";
$amount = abs($obj->amount);
$price = abs(price($obj->price));
$tva = abs($obj->tva);
$facnumber = $obj->facnumber;
if (dol_strlen(trim($obj->increment)) > 0)
{
$facnumber = $obj->increment;
}
if (dol_strlen($obj->nom) > 31)
{
$socnom = substr($obj->nom, 0 , 31);
}
$pdf->SetFont('Arial','',9);
if ($obj->amount >= 0)
{
$d = "D";
$c = "C";
$credit = '';
$debit = $amount;
$total_debit = $total_debit + $debit;
$grand_total_debit = $grand_total_debit + $debit;
}
else
{
$d = "C";
$c = "D";
$credit = $amount;
$debit = '';
$total_credit = $total_credit + $credit;
$grand_total_credit = $grand_total_credit + $credit;
}
if ($oldfac <> $obj->facid)
{
$oldfac = $obj->facid;
$pdf->cell($wc[1],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp)));
$pdf->cell($wc[2],$hligne,'VI');
$pdf->cell($wc[3],$hligne,'41100000');
$pdf->cell($wc[4],$hligne,$obj->code_compta);
$pdf->cell($wc[5],$hligne,$socnom .' '.$libelle);
$pdf->cell($wc[6],$hligne,$facnumber);
$pdf->cell($wc[7],$hligne,$amount,0,0,'R');
$pdf->cell($wc[8],$hligne,$d);
$pdf->cell($wc[9],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp)),0,0,'R');
$pdf->ln();
$pdf->cell($wc[1],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp)));
$pdf->cell($wc[2],$hligne,'VI');
$pdf->cell($wc[3],$hligne,'4457119');
$pdf->cell($wc[4],$hligne,'');
$pdf->cell($wc[5],$hligne,$socnom .' '.$libelle);
$pdf->cell($wc[6],$hligne,$facnumber);
$pdf->cell($wc[7],$hligne,$tva,0,0,'R');
$pdf->cell($wc[8],$hligne,$c);
$pdf->cell($wc[9],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp)),0,0,'R');
$pdf->ln();
}
$pdf->cell($wc[1],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp)));
$pdf->cell($wc[2],$hligne,'VI');
$pdf->cell($wc[3],$hligne,$obj->numero);
$pdf->cell($wc[4],$hligne,'');
$pdf->cell($wc[5],$hligne,$socnom .' '.$libelle);
$pdf->cell($wc[6],$hligne,$facnumber);
$pdf->cell($wc[7],$hligne,$price,0,0,'R');
$pdf->cell($wc[8],$hligne,$c);
$pdf->cell($wc[9],$hligne,strftime('%d%m%y',$this->db->jdate($obj->dp)),0,0,'R');
$pdf->ln();
$i++;
}
/*
*
*
*/
$pdf->Close();
$pdf->Output($file);
$result = 0;
}
else
{
$result -1;
}
}
else
{
$result = -2;
}
return $result;
}
}
?>

View File

@ -1,179 +0,0 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/compta/export/index.php
\ingroup compta
\brief Page export ventilations
\version $Revision$
*/
require("../../main.inc.php");
require_once("./class/ComptaJournalPaiement.class.php");
require_once("./class/ComptaJournalVente.class.php");
$langs->load("compta");
$now = time();
if (isset($_GET["year"]))
{
$year = $_GET["year"];
}
else
{
$year = strftime("%Y",$now);
}
$updir = $conf->compta->dir_output."/export/";
$dir = $conf->compta->dir_output."/export/".$year."/";
/*
* Actions
*/
if ($_GET["action"] == 'export')
{
$modulename='Poivre';
include_once DOL_DOCUMENT_ROOT.'/compta/export/modules/compta.export.class.php';
create_exdir($dir);
$exc = new ComptaExport($db, $user, $modulename);
if($_GET["id"] > 0)
{
$exc->Export($_GET["id"], $dir);
}
else
{
$exc->Export(0, $dir);
}
/* G<>n<EFBFBD>ration du journal des Paiements */
$jp= new ComptaJournalPaiement($db);
$jp->generatePdf($user, $dir, $exc->id, $exc->ref);
/* G<>n<EFBFBD>ration du journal des Ventes */
$jp= new ComptaJournalVente($db);
$jp->generatePdf($user, $dir, $exc->id, $exc->ref);
}
/*
* Affichage page
*/
llxHeader('','Compta - Export');
print_fiche_titre($langs->trans("AccountancyExport"));
if ($exc->error_message)
{
print '<div class="error">'.$exc->error_message.'</div>';
}
print '<table class="notopnoleftnoright" width="100%">';
print '<tr><td valign="top" width="30%">';
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."facturedet";
$sql .= " WHERE fk_export_compta = 0";
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
$nbfac = $obj->nb;
$db->free($resql);
}
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."paiement";
$sql .= " WHERE fk_export_compta = 0";
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
$nbp = $obj->nb;
$db->free($resql);
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Nb").'</td><td align="right">'.$langs->trans("Nb").'</td></tr>';
$var=false;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Invoices").'</td><td align="right">'.$nbfac.'</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Payments").'</td><td align="right">'.$nbp.'</td></tr>';
print "</table><br>\n";
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Year").'</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
$handle=@opendir($updir);
if ($handle)
{
while (($file = readdir($handle))!==false)
{
if (is_readable($updir.$file) && is_dir($updir.$file) && dol_strlen($file) == 4)
{
$var=!$var;
print '<tr '.$bc[$var].'><td><a href="index.php?year='.$file.'">'.$file.'</a><td></tr>';
}
}
closedir($handle);
}
print "</table>";
print '</td><td valign="top" width="70%">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("File").'</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
$handle=@opendir($dir);
if ($handle)
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && is_file($dir.$file))
{
print '<tr><td><a href="'.DOL_URL_ROOT.'/document.php?modulepart=export_compta&amp;file=export/'.$year.'/'.$file.'&amp;type=text/plain">'.$file.'</a><td>';
print '</tr>';
}
}
closedir($handle);
}
print "</table>";
print '</td></tr></table>';
llxFooter('$Date$ - $Revision$');
?>

View File

@ -1,107 +0,0 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
/**
\file htdocs/compta/export/liste.php
\ingroup compta
\brief Page export ventilations
\version $Revision$
*/
require("../../main.inc.php");
$langs->load("compta");
$dir = $conf->compta->dir_output."/export/";
// Security check
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
$page = $_GET["page"];
$sortorder = $_GET["sortorder"];
$sortfield = $_GET["sortfield"];
$offset = $conf->liste_limit * $page ;
if ($sortorder == "") $sortorder="DESC";
if ($sortfield == "") $sortfield="ec.date_export";
/*
* Mode Liste
*
*/
llxHeader('','Compta - Export');
$sql = "SELECT ec.rowid, ec.date_export as date_export, ec.ref";
$sql .= " FROM ".MAIN_DB_PREFIX."export_compta as ec";
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
print_barre_liste($langs->trans("Exports"), $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),"liste.php","ec.ref");
print_liste_field_titre($langs->trans("Date"),"liste.php","ec.date_export");
print "<td>-</td></tr>\n";
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print '<td>'.$obj->ref.'</td>';
print '<td>'.dol_print_date($db->jdate($obj->date_export),"dayhour").'</td>';
print '<td><a href="index.php?action=export&amp;id='.$obj->rowid.'">'.$langs->trans("ReBuild").'</a></td>';
print "</tr>\n";
$i++;
}
print "</table>";
$db->free($result);
}
else
{
dol_print_error($db);
}
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -1,235 +0,0 @@
<?PHP
/* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/compta/export/modules/compta.export.class.php
\ingroup compta
\brief Fichier de la classe d'export compta
\version $Revision$
*/
/**
\class ComptaExport
\brief Parent class for class to build accountancy export
*/
class ComptaExport
{
/**
\brief Constructeur de la class
\param DB Object de base de donnees
\param USER Object utilisateur
\param classe Nom de la classe utilisee pour formater les rapports
*/
function ComptaExport ($DB, $USER, $classname)
{
$this->db = $DB;
$this->user = $USER;
$this->classe_export = $classname;
$this->error_message = '';
}
/**
\brief Lecture des factures dans la base
\param id Id ligne
*/
function ReadLines($id=0)
{
global $langs;
dol_syslog("ComptaExport::ReadLines id=".$id);
$error = 0;
$sql = "SELECT f.rowid as facid, f.facnumber, f.datef";
$sql .= " , f.total_ttc, f.tva ";
$sql .= " ,s.nom, s.rowid as socid, s.code_compta";
$sql .= " , l.price, l.tva_tx";
$sql .= " , c.numero, f.increment";
$sql .= " , l.rowid as lrowid";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l";
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c";
$sql .= " WHERE f.rowid = l.fk_facture ";
$sql .= " AND s.rowid = f.fk_soc";
$sql .= " AND f.fk_statut = 1 ";
$sql .= " AND l.fk_code_ventilation <> 0 ";
$sql .= " AND l.fk_export_compta = ".$id;
$sql .= " AND c.rowid = l.fk_code_ventilation";
$sql .= " ORDER BY f.rowid ASC, l.fk_code_ventilation ASC";
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
$this->linec = array();
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$this->linec[$i][0] = $this->db->jdate($obj->datef);
$this->linec[$i][1] = $obj->facid;
$this->linec[$i][2] = $obj->code_compta;
$this->linec[$i][3] = $obj->nom;
$this->linec[$i][4] = $obj->numero;
$this->linec[$i][5] = $obj->facnumber;
$this->linec[$i][6] = $obj->tva;
$this->linec[$i][7] = $obj->total_ttc;
$this->linec[$i][8] = $obj->price;
$this->linec[$i][9] = $obj->increment;
$this->linec[$i][10] = $obj->lrowid;
if ($obj->code_compta == '')
{
$societe=new Societe($this->db);
$societe->fetch($obj->socid);
$this->error_message.= $langs->transnoentities("ErrorWrongAccountancyCodeForCompany",$societe->getNomUrl(1))."<br>";
$error++;
}
$i++;
}
$this->db->free($resql);
}
return $error;
}
/**
\brief Lecture des paiements dans la base
\param id Id ligne
*/
function ReadLinesPayment($id=0)
{
dol_syslog("ComptaExport::ReadLinesPayment id=".$id);
$error = 0;
$sql = "SELECT p.rowid as paymentid, f.facnumber";
$sql .= " , p.datep";
$sql .= " , pf.amount";
$sql .= " , s.nom, s.code_compta";
$sql .= " , cp.libelle, f.increment";
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p";
$sql .= " , ".MAIN_DB_PREFIX."paiement_facture as pf";
$sql .= " , ".MAIN_DB_PREFIX."c_paiement as cp";
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE p.fk_export_compta = ".$id;
$sql .= " AND p.rowid = pf.fk_paiement";
$sql .= " AND cp.id = p.fk_paiement";
$sql .= " AND f.rowid = pf.fk_facture";
$sql .= " AND f.fk_soc = s.rowid";
$sql .= " AND p.statut = 1 ";
$sql .= " ORDER BY f.rowid ASC, p.rowid ASC";
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
$this->linep = array();
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$this->linep[$i][0] = $this->db->jdate($obj->datep);
$this->linep[$i][1] = $obj->paymentid;
$this->linep[$i][2] = $obj->code_compta;
$this->linep[$i][3] = $obj->nom;
$this->linep[$i][4] = $obj->facnumber;
$this->linep[$i][5] = $obj->amount;
$this->linep[$i][6] = $obj->libelle;
if (dol_strlen(trim( $obj->increment)) > 0)
{
$this->linep[$i][7] = $obj->increment;
}
else
{
$this->linep[$i][7] = $obj->facnumber;
}
$i++;
}
$this->db->free($resql);
}
else
{
$error++;
}
return $error;
}
/**
\brief Cr<EFBFBD><EFBFBD> le fichier d'export
*/
function Export($id=0, $dir)
{
$error = 0;
dol_syslog("ComptaExport::Export");
$error += $this->ReadLines($id);
$error += $this->ReadLinesPayment($id);
dol_syslog("ComptaExport::Export Lignes de factures : ".sizeof($this->linec));
dol_syslog("ComptaExport::Export Lignes de paiements : ".sizeof($this->linep));
if (!$error && (sizeof($this->linec) > 0 || sizeof($this->linep) > 0))
{
include_once DOL_DOCUMENT_ROOT.'/compta/export/modules/compta.export.'.strtolower($this->classe_export).'.class.php';
$objexport_name = "ComptaExport".$this->classe_export;
$objexport = new $objexport_name($this->db, $this->user);
$objexport->Export($dir, $this->linec, $this->linep, $id);
$this->id = $objexport->id;
$this->ref = $objexport->ref;
}
}
}

View File

@ -1,369 +0,0 @@
<?PHP
/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/compta/export/modules/compta.export.poivre.class.php
\ingroup compta
\brief Modele d'export compta poivre, export au format tableur
\remarks Ce fichier doit etre utilise comme un exemple, il est specifique a une utilisation particuliere
\version $Revision$
*/
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_workbook.inc.php");
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_worksheet.inc.php");
/**
\class ComptaExportPoivre
\brief Classe permettant les exports comptables au format tableur
*/
class ComptaExportPoivre extends ComptaExport
{
var $db;
var $user;
/**
\brief Constructeur de la class
\param DB Object de base de donnees
\param USER Object utilisateur
*/
function ComptaExportPoivre ($DB, $USER)
{
$this->db = $DB;
$this->user = $USER;
}
/**
* Agregation des lignes de facture
*/
function Agregate($line_in)
{
dol_syslog("ComptaExportPoivre::Agregate");
dol_syslog("ComptaExportPoivre::Agregate " . sizeof($line_in) . " lignes en entrees");
$i = 0;
$j = 0;
$n = sizeof($line_in);
// On commence par la ligne 0
$this->line_out[$j] = $line_in[$i];
//print "$j ".$this->line_out[$j][8] . "<br>";
for ( $i = 1 ; $i < $n ; $i++)
{
// On agrege les lignes avec le meme code comptable
if ( ($line_in[$i][1] == $line_in[$i-1][1]) && ($line_in[$i][4] == $line_in[$i-1][4]) )
{
$this->line_out[$j][8] = ($this->line_out[$j][8] + $line_in[$i][8]);
}
else
{
$j++;
$this->line_out[$j] = $line_in[$i];
}
}
dol_syslog("ComptaExportPoivre::Agregate " . sizeof($this->line_out) . " lignes en sorties");
return 0;
}
/**
*
*/
function Export($dir, $linec, $linep, $id=0)
{
$error = 0;
dol_syslog("ComptaExportPoivre::Export");
dol_syslog("ComptaExportPoivre::Export " . sizeof($linec) . " lignes en entrees");
$this->Agregate($linec);
$this->db->begin();
if ($id == 0)
{
$dt = strftime('EC%y%m', time());
$sql = "SELECT count(ref) FROM ".MAIN_DB_PREFIX."export_compta";
$sql .= " WHERE ref like '".$dt."%'";
$resql=$this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
$cc = $row[0];
}
else
{
$error++;
dol_syslog("ComptaExportPoivre::Export Erreur Select");
}
if (!$error)
{
$this->ref = $dt . substr("000".$cc, -2);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."export_compta (ref, date_export, fk_user)";
$sql .= " VALUES ('".$this->ref."', ".$this->db->idate(mktime()).",".$this->user->id.")";
if ($this->db->query($sql))
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."export_compta");
}
else
{
$error++;
dol_syslog("ComptaExportPoivre::Export Erreur INSERT");
}
}
}
else
{
$this->id = $id;
$sql = "SELECT ref FROM ".MAIN_DB_PREFIX."export_compta";
$sql .= " WHERE rowid = ".$this->id;
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
$this->ref = $row[0];
}
else
{
$error++;
dol_syslog("ComptaExportPoivre::Export Erreur Select");
}
}
if (!$error)
{
dol_syslog("ComptaExportPoivre::Export ref : ".$this->ref);
$fxname = $dir . "/".$this->ref.".xls";
$workbook = new writeexcel_workbook($fxname);
$page = &$workbook->addworksheet('Export');
$page->set_column(0,0,8); // A
$page->set_column(1,1,6); // B
$page->set_column(2,2,9); // C
$page->set_column(3,3,14); // D
$page->set_column(4,4,44); // E
$page->set_column(5,5,9); // F Numero de piece
$page->set_column(6,6,8); // G
// Pour les factures
// A 0 Date Operation 040604 pour 4 juin 2004
// B 1 VE -> ventilation
// C 2 code Compte general
// D 3 code client
// E 4 Intitul
// F 5 Numero de piece
// G 7 Montant
// H 8 Type operation D pour Debit ou C pour Credit
// I Date d'echeance, = a la date d'operation si pas d'echeance
// J EUR pour Monnaie en Euros
// Pour les paiements
$i = 0;
$j = 0;
$n = sizeof($this->line_out);
$oldfacture = 0;
for ( $i = 0 ; $i < $n ; $i++)
{
if ( $oldfacture <> $this->line_out[$i][1])
{
// Ligne client
$page->write_string($j, 0, strftime("%d%m%y",$this->line_out[$i][0]));
$page->write_string($j, 1, "VI");
$page->write_string($j, 2, "41100000");
$page->write_string($j, 3, stripslashes($this->line_out[$i][2]));
$page->write_string($j, 4, stripslashes($this->line_out[$i][3])." Facture");
$page->write_string($j, 5, $this->line_out[$i][5]); // Numero de facture
$page->write($j, 6, price2num($this->line_out[$i][7]));
$page->write_string($j, 7, 'D' ); // D pour debit
$page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0]));
$j++;
// Ligne TVA
$page->write_string($j, 0, strftime("%d%m%y",$this->line_out[$i][0]));
$page->write_string($j, 1, "VI");
$page->write_string($j, 2, '4457119');
$page->write_string($j, 4, stripslashes($this->line_out[$i][3])." Facture");
$page->write_string($j, 5, $this->line_out[$i][5]); // Numero de facture
$page->write($j, 6, price2num($this->line_out[$i][6])); // Montant de TVA
$page->write_string($j, 7, 'C'); // C pour credit
$page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0]));
$oldfacture = $this->line_out[$i][1];
$j++;
}
$page->write_string($j, 0, strftime("%d%m%y",$this->line_out[$i][0]));
$page->write_string($j, 1, 'VI');
$page->write_string($j, 2, $this->line_out[$i][4]); // Code Comptable
$page->write_string($j, 4, $this->line_out[$i][3]." Facture");
$page->write_string($j, 5, $this->line_out[$i][5]);
$page->write($j, 6, price2num(round($this->line_out[$i][8], 2)));
$page->write_string($j, 7, 'C'); // C pour credit
$page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0]));
$j++;
}
// Tag des lignes de factures
$n = sizeof($linec);
for ( $i = 0 ; $i < $n ; $i++)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet";
$sql .= " SET fk_export_compta=".$this->id;
$sql .= " WHERE rowid = ".$linec[$i][10];
if (!$this->db->query($sql))
{
$error++;
}
}
// Pour les paiements
// A Date Operation 040604 pour 4 juin 2004
// B CE -> caisse d'epargne
// C code Compte general
// D code client
// E Intitul
// F Numero de piece
// G Montant
// H Type operation D pour Debit ou C pour Credit
// I Date d'echeance, = a la date d'operation si pas d'echeance
// J EUR pour Monnaie en Euros
$i = 0;
//$j = 0;
$n = sizeof($linep);
$oldfacture = 0;
for ( $i = 0 ; $i < $n ; $i++)
{
/*
* En cas de rejet ou paiement en negatif on inverse debit et credit
*
*
*/
if ($linep[$i][5] >= 0)
{
$debit = "D";
$credit = "C";
}
else
{
$debit = "C";
$credit = "D";
if ($linep[$i][6] == 'Prelevement')
{
$linep[$i][6] = 'Rejet Prelevement';
}
}
$page->write_string($j,0, strftime("%d%m%y",$linep[$i][0]));
$page->write_string($j,1, 'CE');
$page->write_string($j,2, '5122000');
if ($linep[$i][6] == 'Prelevement')
{
$linep[$i][6] = 'Prelevement';
}
$page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); //
$page->write_string($j,5, $linep[$i][7]); // Numero de facture
$page->write($j,6, price2num(round(abs($linep[$i][5]), 2))); // Montant de la ligne
$page->write_string($j,7,$debit);
$page->write_string($j,8, strftime("%d%m%y",$linep[$i][0]));
$j++;
$page->write_string($j,0, strftime("%d%m%y",$linep[$i][0]));
$page->write_string($j,1, 'CE');
$page->write_string($j,2, '41100000');
$page->write_string($j,3, $linep[$i][2]);
$page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); //
$page->write_string($j,5, $linep[$i][7]); // Numero de facture
$page->write($j,6, price2num(round(abs($linep[$i][5]), 2))); // Montant de la ligne
$page->write_string($j,7, $credit);
$page->write_string($j,8, strftime("%d%m%y",$linep[$i][0]));
$j++;
}
$workbook->close();
// Tag des lignes de factures
$n = sizeof($linep);
for ( $i = 0 ; $i < $n ; $i++)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."paiement";
$sql .= " SET fk_export_compta=".$this->id;
$sql .= " WHERE rowid = ".$linep[$i][1];
if (!$this->db->query($sql))
{
$error++;
}
}
}
if (!$error)
{
$this->db->commit();
dol_syslog("ComptaExportPoivre::Export COMMIT");
}
else
{
$this->db->rollback();
dol_syslog("ComptaExportPoivre::Export ROLLBACK");
}
return 0;
}
}

View File

@ -1,136 +0,0 @@
<?PHP
/* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
\file htdocs/compta/export/modules/compta.export.safran.class.php
\ingroup compta
\brief Modele d'export compta safran, export au format tableur
\remarks Ce fichier doit etre utilise comme un exemple, il est specifique a une utilisation particuliere
\version $Revision$
*/
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_workbook.inc.php");
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_worksheet.inc.php");
/**
\class ComptaExportTableur
\brief Classe permettant les exports comptables au format tableur
*/
class ComptaExportTableur extends ComptaExport
{
function ComptaExportTableur ()
{
}
function Create()
{
$this->date = time();
$this->datef = "commande-".strftime("%d%b%y-%HH%M", $this->date);
$fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$this->datef.".xls";
if (dol_strlen(trim($this->fournisseur->email_commande)) == 0)
{
return -3;
}
if (file_exists($fname))
{
return 2;
}
else
{
$res = $this->CreateFile($fname);
$res = $res + $this->LogSql();
$res = $res + $this->MailFile($fname);
return $res;
}
}
function Export($dir, $linec)
{
//$fname = $dir . "/tmp/toto.xls"; DEBUG DEBUG
$fname = "/tmp/toto.xls";
$workbook = new writeexcel_workbook($fname);
$worksheet = &$workbook->addworksheet();
// Pour les factures
// Date Operation 040604 pour 4 juin 2004
// VE -> ventilation
// code Compte general
// code client
// Intitul
// Numero de piece
// Montant
// Type operation D pour Debit ou C pour Credit
// Date d'echeance, = a la date d'operation si pas d'echeance
// EUR pour Monnaie en Euros
// Pour les paiements
$worksheet->set_column('A:A', 20);
$worksheet->set_column('B:B', 20);
$worksheet->set_column('C:C', 15);
$worksheet->set_column('D:D', 9);
$worksheet->set_column('E:E', 16);
$worksheet->set_column('F:F', 18);
$worksheet->set_column('G:G', 20);
$i = 0;
$j = 0;
$n = sizeof($linec);
$oldfacture = 0;
for ( $i = 0 ; $i < $n ; $i++)
{
if ( $oldfacture <> $linec[$i][1])
{
$worksheet->write_string($j, 0, strftime("%d%m%y",$linec[$i][0]));
$worksheet->write_string($j, 1, 'VE');
$worksheet->write_string($j, 3, '411000000');
$worksheet->write_string($j, 4, $linec[$i][3]." Facture");
$oldfacture = $linec[$i][1];
$j++;
}
$worksheet->write_string($j, 0, strftime("%d%m%y",$linec[$i][0]));
$worksheet->write_string($j, 1, 'VE');
$worksheet->write_string($j, 2, $linec[$i][4]);
$worksheet->write_string($j, 4, $linec[$i][3]." Facture");
$j++;
}
$workbook->close();
return 0;
}
}