mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-12 10:52:37 +01:00
Modif de l'appel de Export()
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* 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
|
||||
@@ -21,122 +21,122 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/export/modules/compta.export.class.php
|
||||
\ingroup compta
|
||||
\brief Fichier de la classe d'export compta
|
||||
\version $Revision$
|
||||
\file htdocs/compta/export/modules/compta.export.class.php
|
||||
\ingroup compta
|
||||
\brief Fichier de la classe d'export compta
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\class ComptaExport
|
||||
\brief Classe permettant les exports comptables
|
||||
\class ComptaExport
|
||||
\brief Classe permettant les exports comptables
|
||||
*/
|
||||
|
||||
class ComptaExport
|
||||
{
|
||||
/**
|
||||
\brief Constructeur de la class
|
||||
\param DB Object de base de donn<6E>es
|
||||
\param USER Object utilisateur
|
||||
\param classe Nom de la classe utilis<69>e pour formater les rapports
|
||||
*/
|
||||
function ComptaExport ($DB, $USER, $classe)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->user = $USER;
|
||||
$this->classe_export = $classe;
|
||||
$this->error_message = '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Lecture des factures dans la base
|
||||
\param id Id ligne
|
||||
*/
|
||||
function ReadLines($id=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
dolibarr_syslog("ComptaExport::ReadLines id=".$id);
|
||||
|
||||
$error = 0;
|
||||
|
||||
$sql = "SELECT f.rowid as facid, f.facnumber, ".$this->db->pdate("f.datef")." as datef";
|
||||
$sql .= " , f.total_ttc, f.tva ";
|
||||
$sql .= " ,s.nom, s.idp, s.code_compta";
|
||||
$sql .= " , l.price, l.tva_taux";
|
||||
$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.idp = 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] = $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->idp);
|
||||
$this->error_message.= $langs->transnoentities("ErrorWrongAccountancyCodeForCompany",$societe->getNomUrl(1));
|
||||
$error++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Lecture des paiements dans la base
|
||||
\param id Id ligne
|
||||
\brief Constructeur de la class
|
||||
\param DB Object de base de donn<6E>es
|
||||
\param USER Object utilisateur
|
||||
\param classe Nom de la classe utilis<69>e pour formater les rapports
|
||||
*/
|
||||
|
||||
function ComptaExport ($DB, $USER, $classe)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->user = $USER;
|
||||
$this->classe_export = $classe;
|
||||
$this->error_message = '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Lecture des factures dans la base
|
||||
\param id Id ligne
|
||||
*/
|
||||
function ReadLines($id=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
dolibarr_syslog("ComptaExport::ReadLines id=".$id);
|
||||
|
||||
$error = 0;
|
||||
|
||||
$sql = "SELECT f.rowid as facid, f.facnumber, ".$this->db->pdate("f.datef")." as datef";
|
||||
$sql .= " , f.total_ttc, f.tva ";
|
||||
$sql .= " ,s.nom, s.idp, s.code_compta";
|
||||
$sql .= " , l.price, l.tva_taux";
|
||||
$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.idp = 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] = $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->idp);
|
||||
$this->error_message.= $langs->transnoentities("ErrorWrongAccountancyCodeForCompany",$societe->getNomUrl(1));
|
||||
$error++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Lecture des paiements dans la base
|
||||
\param id Id ligne
|
||||
*/
|
||||
|
||||
function ReadLinesPayment($id=0)
|
||||
{
|
||||
dolibarr_syslog("ComptaExport::ReadLinesPayment id=".$id);
|
||||
$error = 0;
|
||||
|
||||
|
||||
$sql = "SELECT p.rowid as paymentid, f.facnumber";
|
||||
$sql .= " ,".$this->db->pdate("p.datep")." as datep";
|
||||
$sql .= " , pf.amount";
|
||||
@@ -205,7 +205,7 @@ class ComptaExport
|
||||
\brief Cr<43><72> le fichier d'export
|
||||
*/
|
||||
|
||||
function Export($id=0)
|
||||
function Export($id=0, $dir)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
@@ -225,7 +225,7 @@ class ComptaExport
|
||||
|
||||
$objexport = new $objexport_name($this->db, $this->user);
|
||||
|
||||
$objexport->Export($this->linec, $this->linep, $id);
|
||||
$objexport->Export($dir, $this->linec, $this->linep, $id);
|
||||
|
||||
$this->id = $objexport->id;
|
||||
$this->ref = $objexport->ref;
|
||||
|
||||
Reference in New Issue
Block a user