Qual: Debuggage module compta simple
This commit is contained in:
parent
ddcb333393
commit
5e822a1d71
@ -31,6 +31,9 @@ require("./pre.inc.php");
|
||||
require_once("./ComptaJournalPaiement.class.php");
|
||||
require_once("./ComptaJournalVente.class.php");
|
||||
|
||||
$langs->load("compta");
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -70,11 +73,11 @@ if ($_GET["action"] == 'export')
|
||||
|
||||
llxHeader('','Compta - Export');
|
||||
|
||||
print_titre("Export Comptable");
|
||||
print_fiche_titre($langs->trans("AccountancyExport"));
|
||||
|
||||
if ($exc->error_message);
|
||||
if ($exc->error_message)
|
||||
{
|
||||
print $exc->error_message;
|
||||
print '<div class="error">'.$exc->error_message.'</div>';
|
||||
}
|
||||
|
||||
|
||||
@ -105,9 +108,11 @@ if ($resql)
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>Type</td><td align="center">Nb</td></tr>';
|
||||
print '<tr><td>Factures à exporter</td><td align="center">'.$nbfac.'</td></tr>';
|
||||
print '<tr><td>Paiements à exporter</td><td align="center">'.$nbp.'</td></tr>';
|
||||
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>\n";
|
||||
|
||||
print '</td><td valign="top" width="70%">';
|
||||
@ -116,7 +121,7 @@ $dir = DOL_DATA_ROOT."/compta/export/";
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("File").'</td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -137,5 +142,5 @@ print "</table>";
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -17,14 +17,14 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
llxHeader('','Compta - Export');
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
$langs->load("compta");
|
||||
|
||||
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
@ -32,6 +32,8 @@ if ($user->societe_id > 0)
|
||||
}
|
||||
|
||||
|
||||
llxHeader('','Compta - Export');
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
@ -48,8 +50,6 @@ if ($sortfield == "") $sortfield="ec.date_export";
|
||||
/*
|
||||
* Mode Liste
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT ec.rowid,".$db->pdate("ec.date_export")." as date_export, ec.ref";
|
||||
@ -85,7 +85,7 @@ if ($result)
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td>'.stripslashes($obj->ref).'</td>';
|
||||
print '<td>'.$obj->ref.'</td>';
|
||||
print '<td>'.strftime("%a %e %b %Y %H:%M:%S",$obj->date_export).'</td>';
|
||||
print '<td><a href="index.php?action=export&id='.$obj->rowid.'">Regénérer</a></td>';
|
||||
print "</tr>\n";
|
||||
@ -101,5 +101,5 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004-2005 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
|
||||
@ -34,94 +35,97 @@
|
||||
|
||||
class ComptaExport
|
||||
{
|
||||
/**
|
||||
\brief Constructeur de la class
|
||||
\param DB Object de base de données
|
||||
\param USER Object utilisateur
|
||||
\param classe Nom de la classe utilisé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;
|
||||
|
||||
/**
|
||||
\brief Constructeur de la class
|
||||
\param DB Object de base de données
|
||||
\param USER Object utilisateur
|
||||
\param classe Nom de la classe utilisé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)
|
||||
{
|
||||
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.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 == '')
|
||||
{
|
||||
$this->error_message .= "Code compta non valide pour $obj->nom<br>";
|
||||
$error++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
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
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004 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
|
||||
@ -19,9 +20,8 @@
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php";
|
||||
|
||||
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_workbook.inc.php");
|
||||
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_worksheet.inc.php");
|
||||
|
||||
|
||||
class ComptaExportPoivre extends ComptaExport
|
||||
@ -170,16 +170,16 @@ class ComptaExportPoivre extends ComptaExport
|
||||
|
||||
// Pour les factures
|
||||
|
||||
//A 0 Date Opération 040604 pour 4 juin 2004
|
||||
//B 1 VE -> ventilation
|
||||
//C 2 code Compte général
|
||||
//D 3 code client
|
||||
//E 4 Intitul
|
||||
//F 5 Numéro de pièce
|
||||
//G 6 Date d'échéance, = à la date d'opération si pas d'échéance
|
||||
//H 7 Montant
|
||||
//I 8 Type opération D pour Débit ou C pour Crédit
|
||||
//J 9 EUR pour Monnaie en Euros
|
||||
// A 0 Date Opération 040604 pour 4 juin 2004
|
||||
// B 1 VE -> ventilation
|
||||
// C 2 code Compte général
|
||||
// D 3 code client
|
||||
// E 4 Intitul
|
||||
// F 5 Numéro de pièce
|
||||
// G 7 Montant
|
||||
// H 8 Type opération D pour Débit ou C pour Crédit
|
||||
// I Date d'échéance, = à la date d'opération si pas d'échéance
|
||||
// J EUR pour Monnaie en Euros
|
||||
|
||||
// Pour les paiements
|
||||
|
||||
@ -250,16 +250,16 @@ class ComptaExportPoivre extends ComptaExport
|
||||
|
||||
// Pour les paiements
|
||||
|
||||
// Date Opération 040604 pour 4 juin 2004
|
||||
// CE -> caisse d'epargne
|
||||
// code Compte général
|
||||
// code client
|
||||
// Intitul
|
||||
// Numéro de pièce
|
||||
// Montant
|
||||
// Type opération D pour Débit ou C pour Crédit
|
||||
// Date d'échéance, = à la date d'opération si pas d'échéance
|
||||
// EUR pour Monnaie en Euros
|
||||
// A Date Opération 040604 pour 4 juin 2004
|
||||
// B CE -> caisse d'epargne
|
||||
// C code Compte général
|
||||
// D code client
|
||||
// E Intitul
|
||||
// F Numéro de pièce
|
||||
// G Montant
|
||||
// H Type opération D pour Débit ou C pour Crédit
|
||||
// I Date d'échéance, = à la date d'opération si pas d'échéance
|
||||
// J EUR pour Monnaie en Euros
|
||||
|
||||
$i = 0;
|
||||
//$j = 0;
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php";
|
||||
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_workbook.inc.php");
|
||||
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_worksheet.inc.php");
|
||||
|
||||
|
||||
class ComptaExportTableur extends ComptaExport
|
||||
|
||||
@ -100,16 +100,16 @@ print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
||||
*/
|
||||
if ($conf->facture->enabled)
|
||||
{
|
||||
print '<form method="post" action="facture.php">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td colspan="3">'.$langs->trans("SearchABill").'</td></tr>';
|
||||
print "<tr $bc[0]><td>".$langs->trans("Ref").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>';
|
||||
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print "<tr $bc[0]><td>".$langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="18"></td>';
|
||||
print '</tr>';
|
||||
print "</table></form><br>";
|
||||
print '<form method="post" action="facture.php">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<td colspan="3">'.$langs->trans("SearchABill").'</td></tr>';
|
||||
print "<tr $bc[0]><td>".$langs->trans("Ref").':</td><td><input type="text" name="sf_ref" class="flat" size="18"></td>';
|
||||
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print "<tr $bc[0]><td>".$langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="18"></td>';
|
||||
print '</tr>';
|
||||
print "</table></form><br>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-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
|
||||
@ -28,14 +28,19 @@
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
|
||||
$mesg = '';
|
||||
|
||||
if (!$user->rights->compta->ventilation->creer) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'ventil' && $user->rights->compta->ventilation->creer)
|
||||
{
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||
@ -79,6 +84,7 @@ if ($result)
|
||||
*
|
||||
*/
|
||||
$form = new Form($db);
|
||||
$facture_static=new Facture($db);
|
||||
|
||||
if($_GET["id"])
|
||||
{
|
||||
@ -110,14 +116,19 @@ if($_GET["id"])
|
||||
}
|
||||
|
||||
|
||||
print_titre("Ventilation");
|
||||
print_fiche_titre("Ventilation");
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td>'.$langs->trans("Bill").'</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a></td></tr>';
|
||||
|
||||
// Ref facture
|
||||
print '<tr><td>'.$langs->trans("Invoice").'</td>';
|
||||
$facture_static->ref=$objp->facnumber;
|
||||
$facture_static->id=$objp->facid;
|
||||
print '<td>'.$facture_static->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td width="20%">Ligne</td>';
|
||||
print '<td>'.stripslashes(nl2br($objp->description)).'</td></tr>';
|
||||
print '<td>'.nl2br($objp->description).'</td></tr>';
|
||||
print '<tr><td width="20%">Ventiler dans le compte :</td><td>';
|
||||
|
||||
if($objp->fk_code_ventilation == 0)
|
||||
|
||||
@ -29,6 +29,8 @@
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$langs->load("compta");
|
||||
|
||||
|
||||
llxHeader('','Compta - Ventilation');
|
||||
|
||||
@ -66,18 +68,18 @@ if ($result)
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">Lignes a ventiler</tr>';
|
||||
print '<tr class="liste_titre"><td>Type</td><td align="center">Nb</td></tr>';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Lines").'</tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Type").'</td><td align="right">'.$langs->trans("Nb").'</td></tr>';
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>".'<td>Factures</td><td align="center">'.$nbfac.'</td></tr>';
|
||||
print "<tr $bc[$var]>".'<td>'.$langs->trans("Invoices").'</td><td align="right">'.$nbfac.'</td></tr>';
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>".'<td>Paiements</td><td align="center">'.$nbp.'</td></tr>';
|
||||
print "<tr $bc[$var]>".'<td>'.$langs->trans("Payments").'</td><td align="right">'.$nbp.'</td></tr>';
|
||||
print "</table>\n";
|
||||
|
||||
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>Type</td><td align="center">Nb de lignes</td><td align="center">Numero</td><td align="center">ID</td></tr>';
|
||||
print '<tr class="liste_titre"><td>Type</td><td align="center">'.$langs->trans("NbOfLines").'</td><td align="center">'.$langs->trans("AccountNumber").'</td><td align="center">'.$langs->trans("TransID").'</td></tr>';
|
||||
|
||||
$sql = "SELECT count(*), ccg.intitule, ccg.rowid,ccg.numero FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql.= " ,".MAIN_DB_PREFIX."compta_compte_generaux as ccg";
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 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
|
||||
@ -20,48 +21,51 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/ventilation/lignes.php
|
||||
\ingroup facture
|
||||
\brief Page de detail des lignes de ventilation d'une facture
|
||||
\version $Revision$
|
||||
\file htdocs/compta/ventilation/lignes.php
|
||||
\ingroup facture
|
||||
\brief Page de detail des lignes de ventilation d'une facture
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("compta");
|
||||
|
||||
$user->getrights('facture');
|
||||
$user->getrights('banque');
|
||||
$langs->load("bills");
|
||||
|
||||
if (!$user->rights->facture->lire) accessforbidden();
|
||||
if (!$user->rights->compta->ventilation->creer) accessforbidden();
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
|
||||
llxHeader('');
|
||||
|
||||
/*
|
||||
* Lignes de factures
|
||||
*
|
||||
*/
|
||||
* Lignes de factures
|
||||
*
|
||||
*/
|
||||
$page = $_GET["page"];
|
||||
if ($page < 0) $page = 0;
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.fk_code_ventilation, c.intitule, c.numero";
|
||||
$sql .= ",p.rowid as product_id, p.ref as product_ref, p.label as product_label";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON (p.rowid = l.fk_product)";
|
||||
$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND l.fk_code_ventilation <> 0 ";
|
||||
$sql .= " AND c.rowid = l.fk_code_ventilation";
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.fk_code_ventilation, c.intitule, c.numero,";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON (p.rowid = l.fk_product)";
|
||||
$sql.= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND l.fk_code_ventilation <> 0 ";
|
||||
$sql.= " AND c.rowid = l.fk_code_ventilation";
|
||||
if (strlen(trim($_GET["search_facture"])))
|
||||
{
|
||||
$sql .= " AND f.facnumber like '%".$_GET["search_facture"]."%'";
|
||||
$sql .= " AND f.facnumber like '%".$_GET["search_facture"]."%'";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY l.rowid DESC";
|
||||
@ -71,54 +75,69 @@ $result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num_lignes = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste("Lignes de facture ventilées",$page,"lignes.php","",$sortfield,$sortorder,'',$num_lignes);
|
||||
$num_lignes = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print '<form method="GET" action="lignes.php">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class=\"liste_titre\"><td>'.$langs->trans("Invoice").'</td>';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="left">'.$langs->trans("Montant").'</td>';
|
||||
print '<td colspan="2" align="left">'.$langs->trans("Compte").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre"><td><input name="search_facture" size="8" value="'.$_GET["search_facture"].'"></td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print_barre_liste("Lignes de facture ventilées",$page,"lignes.php","",$sortfield,$sortorder,'',$num_lignes);
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num_lignes, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
$codeCompta = $objp->numero.' '.stripslashes($objp->intitule);
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a></td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->product_id.'">'.stripslashes($objp->product_ref).'</td>';
|
||||
print '<td>'.stripslashes($objp->product_label).'</td>';
|
||||
print '<td>'.stripslashes(nl2br($objp->description)).'</td>';
|
||||
print '<td align="left">'.price($objp->price).'</td>';
|
||||
print '<td align="left">'.$codeCompta.'</td>';
|
||||
print '<form method="GET" action="lignes.php">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Invoice").'</td>';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="left">'.$langs->trans("Montant").'</td>';
|
||||
print '<td colspan="2" align="left">'.$langs->trans("Compte").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_titre"><td><input name="search_facture" size="8" value="'.$_GET["search_facture"].'"></td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$facture_static=new Facture($db);
|
||||
$product_static=new Product($db);
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num_lignes, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
$codeCompta = $objp->numero.' '.$objp->intitule;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Ref facture
|
||||
$facture_static->ref=$objp->facnumber;
|
||||
$facture_static->id=$objp->facid;
|
||||
print '<td>'.$facture_static->getNomUrl(1).'</td>';
|
||||
|
||||
// Ref produit
|
||||
$product_static->ref=$objp->product_ref;
|
||||
$product_static->id=$objp->product_id;
|
||||
$product_static->type=$objp->type;
|
||||
print '<td>';
|
||||
if ($product_static->id) print $product_static->getNomUrl(1);
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.dolibarr_trunc($objp->product_label,24).'</td>';
|
||||
print '<td>'.nl2br(dolibarr_trunc($objp->description,32)).'</td>';
|
||||
print '<td align="left">'.price($objp->price).'</td>';
|
||||
print '<td align="left">'.$codeCompta.'</td>';
|
||||
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
print "</table></form>";
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
\file htdocs/compta/ventilation/liste.php
|
||||
\ingroup compta
|
||||
\brief Page de ventilation des lignes de facture
|
||||
@ -30,10 +30,14 @@
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
|
||||
$user->getrights('facture');
|
||||
$user->getrights('banque');
|
||||
$langs->load("bills");
|
||||
|
||||
if (!$user->rights->facture->lire) accessforbidden();
|
||||
if (!$user->rights->compta->ventilation->creer) accessforbidden();
|
||||
@ -45,67 +49,82 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
llxHeader('','Ventilation');
|
||||
|
||||
/*
|
||||
* Lignes de factures
|
||||
*
|
||||
*/
|
||||
* Lignes de factures
|
||||
*
|
||||
*/
|
||||
$page = $_GET["page"];
|
||||
if ($page < 0) $page = 0;
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.rowid, l.fk_code_ventilation";
|
||||
$sql .= ",p.rowid as product_id, p.ref as product_ref, p.label as product_label";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON (p.rowid = l.fk_product)";
|
||||
$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND fk_code_ventilation = 0";
|
||||
$sql .= " ORDER BY l.rowid DESC ".$db->plimit($limit+1,$offset);
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.rowid, l.fk_code_ventilation,";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."facture as f)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON (p.rowid = l.fk_product)";
|
||||
$sql.= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND fk_code_ventilation = 0";
|
||||
$sql.= " ORDER BY l.rowid DESC ".$db->plimit($limit+1,$offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num_lignes = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste("Lignes de facture à ventiler",$page,"liste.php","",$sortfield,$sortorder,'',$num_lignes);
|
||||
$num_lignes = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Invoice").'</td>';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Montant").'</td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
print_barre_liste("Lignes de facture à ventiler",$page,"liste.php","",$sortfield,$sortorder,'',$num_lignes);
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num_lignes, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a></td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->product_id.'">'.stripslashes($objp->product_ref).'</td>';
|
||||
print '<td>'.stripslashes($objp->product_label).'</td>';
|
||||
print '<td>'.stripslashes(nl2br($objp->description)).'</td>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Invoice").'</td>';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Montant").'</td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<td align="right">';
|
||||
print price($objp->price);
|
||||
print '</td>';
|
||||
$facture_static=new Facture($db);
|
||||
$product_static=new Product($db);
|
||||
|
||||
print '<td align="right"><a href="fiche.php?id='.$objp->rowid.'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
$var=True;
|
||||
while ($i < min($num_lignes, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
// Ref facture
|
||||
$facture_static->ref=$objp->facnumber;
|
||||
$facture_static->id=$objp->facid;
|
||||
print '<td>'.$facture_static->getNomUrl(1).'</td>';
|
||||
|
||||
// Ref produit
|
||||
$product_static->ref=$objp->product_ref;
|
||||
$product_static->id=$objp->product_id;
|
||||
$product_static->type=$objp->type;
|
||||
print '<td>';
|
||||
if ($product_static->id) print $product_static->getNomUrl(1);
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.dolibarr_trunc($objp->product_label,24).'</td>';
|
||||
print '<td>'.nl2br(dolibarr_trunc($objp->description,32)).'</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print price($objp->price);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right"><a href="fiche.php?id='.$objp->rowid.'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
print $db->error();
|
||||
}
|
||||
$db->close();
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/export/modules_export.php");
|
||||
require_once(PHP_WRITEEXCEL_PATH."class.writeexcel_workbookbig.inc.php");
|
||||
require_once(PHP_WRITEEXCEL_PATH."class.writeexcel_worksheet.inc.php");
|
||||
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_workbookbig.inc.php");
|
||||
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_worksheet.inc.php");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -52,4 +52,6 @@ AlreadyPayed=Already payed
|
||||
AccountNumberShort=Account number
|
||||
AccountNumber=Account number
|
||||
NewAccount=New account
|
||||
SalesTurnover=Sales turnover
|
||||
SalesTurnover=Sales turnover
|
||||
AccountancyExport=Accountancy export
|
||||
ErrorWrongAccountancyCodeForCompany=Bad customer accountancy code for %s
|
||||
@ -52,4 +52,6 @@ AlreadyPayed=D
|
||||
AccountNumberShort=N° du compte
|
||||
AccountNumber=Numéro du compte
|
||||
NewAccount=Nouveau compte
|
||||
SalesTurnover=Chiffre d'affaire
|
||||
SalesTurnover=Chiffre d'affaire
|
||||
AccountancyExport=Export comptable
|
||||
ErrorWrongAccountancyCodeForCompany=Code compta client incorrect pour %s
|
||||
@ -1757,6 +1757,29 @@ function get_each_prod()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
* \param withpicto Inclut le picto dans le lien
|
||||
* \param option Sur quoi pointe le lien
|
||||
* \return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
|
||||
if ($withpicto) {
|
||||
if ($this->type == 0) $result.=($lien.img_object($langs->trans("ShowProduct"),'product').$lienfin.' ');
|
||||
if ($this->type == 1) $result.=($lien.img_object($langs->trans("ShowService"),'service').$lienfin.' ');
|
||||
}
|
||||
$result.=$lien.$this->ref.$lienfin;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne le libellé du statut d'une facture (brouillon, validée, abandonnée, payée)
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
* Export simple des contacts
|
||||
*/
|
||||
|
||||
require_once("../htdocs/master.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php");
|
||||
require_once("../../htdocs/master.inc.php");
|
||||
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_workbook.inc.php");
|
||||
require_once(PHP_WRITEEXCEL_PATH."/class.writeexcel_worksheet.inc.php");
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user