Nouveau fichier
BIN
htdocs/telephonie/graph-1.png
Normal file
|
After Width: | Height: | Size: 198 B |
BIN
htdocs/telephonie/graph1.png
Normal file
|
After Width: | Height: | Size: 197 B |
BIN
htdocs/telephonie/graph2.png
Normal file
|
After Width: | Height: | Size: 191 B |
BIN
htdocs/telephonie/graph3.png
Normal file
|
After Width: | Height: | Size: 193 B |
BIN
htdocs/telephonie/graph4.png
Normal file
|
After Width: | Height: | Size: 198 B |
BIN
htdocs/telephonie/graph5.png
Normal file
|
After Width: | Height: | Size: 198 B |
BIN
htdocs/telephonie/graph6.png
Normal file
|
After Width: | Height: | Size: 193 B |
BIN
htdocs/telephonie/graph7.png
Normal file
|
After Width: | Height: | Size: 209 B |
205
htdocs/telephonie/index.php
Normal file
@ -0,0 +1,205 @@
|
||||
<?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$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php");
|
||||
|
||||
$page = $_GET["page"];
|
||||
$sortorder = $_GET["sortorder"];
|
||||
|
||||
if (!$user->rights->telephonie->lire)
|
||||
accessforbidden();
|
||||
|
||||
llxHeader('','Telephonie');
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* Mode Liste
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
|
||||
print '<tr><td width="30%" valign="top">';
|
||||
|
||||
print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php">';
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre"><td>Recherche ligne</td>';
|
||||
print "</tr>\n";
|
||||
print "<tr $bc[1]>";
|
||||
print '<td>Numéro <input name="search_ligne" size="12"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '<br />';
|
||||
|
||||
|
||||
$sql = "SELECT distinct statut, count(*) as cc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
|
||||
$sql .= " GROUP BY statut";
|
||||
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
$ligne = new LigneTel($db);
|
||||
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre"><td>Lignes Statuts</td><td valign="center">Nb</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object($i);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td>".$ligne->statuts[$obj->statut]."</td>\n";
|
||||
print "<td>".$obj->cc."</td>\n";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error() . ' ' . $sql;
|
||||
}
|
||||
|
||||
print '<br />';
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT distinct f.nom as fournisseur, count(*) as cc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
|
||||
$sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid";
|
||||
$sql .= " GROUP BY f.nom";
|
||||
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre"><td>Fournisseur</td><td align="center">Nb lignes</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object($i);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td>".$obj->fournisseur."</td>\n";
|
||||
print '<td align="center">'.$obj->cc."</td>\n";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error() . ' ' . $sql;
|
||||
}
|
||||
|
||||
print '</td><td width="70%" valign="top">';
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp, f.total_ttc, sum(pf.amount) as am";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f ";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||
$sql .= " WHERE s.idp = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1";
|
||||
$sql .= " GROUP BY f.facnumber,f.rowid,s.nom, s.idp, f.total_ttc";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" cellspacing="0" cellpadding="3" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">Factures clients impayées ('.$num.')</td><td align="right">Montant TTC</td><td align="right">Reçu</td></tr>';
|
||||
$var = True;
|
||||
$total = $totalam = 0;
|
||||
while ($i < $num )
|
||||
{
|
||||
$obj = $db->fetch_object( $i);
|
||||
if ($obj->total_ttc <> $obj->am)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="20%"><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->rowid.'">'.img_file().'</a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->rowid.'">'.$obj->facnumber.'</a></td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="right">'.price($obj->am).'</td></tr>';
|
||||
$total += $obj->total_ttc;
|
||||
$totalam += $obj->am;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="2" align="left">Reste à encaisser : '.price($total-$totalam).'</td><td align="right">'.price($total).'</td><td align="right">'.price($totalam).'</td></tr>';
|
||||
print "</table><br>";
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $sql;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
494
htdocs/telephonie/lignetel.class.php
Normal file
@ -0,0 +1,494 @@
|
||||
<?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$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
class LigneTel {
|
||||
var $db;
|
||||
|
||||
var $id;
|
||||
var $ligne;
|
||||
|
||||
function LigneTel($DB, $id=0)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$this->db = $DB;
|
||||
|
||||
$this->statuts[-1] = "En attente";
|
||||
$this->statuts[1] = "A commander";
|
||||
$this->statuts[2] = "Commandée chez le fournisseur";
|
||||
$this->statuts[3] = "Activée";
|
||||
$this->statuts[4] = "A résilier";
|
||||
$this->statuts[5] = "Résiliation demandée";
|
||||
$this->statuts[6] = "Résiliée";
|
||||
$this->statuts[7] = "Rejetée";
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function update($user)
|
||||
{
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne";
|
||||
$sql .= " SET ";
|
||||
$sql .= " fk_client_comm = $this->client_comm, ";
|
||||
$sql .= " fk_soc = $this->client, ";
|
||||
$sql .= " ligne = '$this->numero', ";
|
||||
$sql .= " fk_soc_facture = $this->client_facture, ";
|
||||
$sql .= " fk_fournisseur = $this->fournisseur, ";
|
||||
$sql .= " fk_commercial = $this->commercial, ";
|
||||
$sql .= " fk_concurrent = $this->concurrent, ";
|
||||
$sql .= " note = '$this->note',";
|
||||
$sql .= " remise = '$this->remise'";
|
||||
$sql .= " WHERE rowid = $this->id";
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
print $sql ;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Infos complémentaires
|
||||
*
|
||||
*/
|
||||
function update_infoc($user)
|
||||
{
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne";
|
||||
$sql .= " SET ";
|
||||
$sql .= " code_analytique = '".$this->code_analytique."' ";
|
||||
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
print $sql ;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_ligne";
|
||||
$sql .= " (fk_soc, fk_client_comm, ligne, fk_soc_facture, fk_fournisseur, note, remise, fk_commercial, statut, fk_user_creat, fk_concurrent)";
|
||||
$sql .= " VALUES (";
|
||||
$sql .= " $this->client,$this->client_comm,'$this->numero',$this->client_facture,$this->fournisseur, '$this->note','$this->remise',$this->commercial, -1,$user->id, $this->concurrent)";
|
||||
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
$this->id = $this->db->last_insert_id();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetch_by_id($id)
|
||||
{
|
||||
return $this->fetch(0, $id);
|
||||
}
|
||||
|
||||
|
||||
function fetch($ligne, $id = 0)
|
||||
{
|
||||
$sql = "SELECT rowid, fk_client_comm, fk_soc, fk_soc_facture, fk_fournisseur, ligne, remise, note, statut, fk_commercial, isfacturable, mode_paiement, fk_concurrent, code_analytique";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as tl";
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
$sql .= " WHERE tl.rowid = ".$id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql .= " WHERE tl.ligne = ".$ligne;
|
||||
}
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$obj = $this->db->fetch_object(0);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->numero = $obj->ligne;
|
||||
$this->remise = $obj->remise;
|
||||
$this->client_comm_id = $obj->fk_client_comm;
|
||||
$this->client_id = $obj->fk_soc;
|
||||
$this->client_facture_id = $obj->fk_soc_facture;
|
||||
$this->fournisseur_id = $obj->fk_fournisseur;
|
||||
$this->commercial_id = $obj->fk_commercial;
|
||||
$this->concurrent_id = $obj->fk_concurrent;
|
||||
$this->statut = $obj->statut;
|
||||
$this->mode_paiement = $obj->mode_paiement;
|
||||
$this->code_analytique = $obj->code_analytique;
|
||||
|
||||
if ($obj->isfacturable == 'oui')
|
||||
{
|
||||
$this->facturable = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->facturable = 0;
|
||||
}
|
||||
|
||||
$result = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = -2;
|
||||
}
|
||||
|
||||
$this->db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Erreur select SQL */
|
||||
print $this->db->error();
|
||||
$result = -1;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function print_concurrent_nom()
|
||||
{
|
||||
$sql = "SELECT nom";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_concurrents";
|
||||
$sql .= " WHERE rowid=".$this->concurrent_id;
|
||||
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$row = $this->db->fetch_row(0);
|
||||
|
||||
return $row[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change le statut de la ligne
|
||||
*
|
||||
*/
|
||||
function set_statut($user, $statut, $datea='', $commentaire='')
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne";
|
||||
$sql .= " SET statut = ".$statut ;
|
||||
|
||||
if ($statut == 2)
|
||||
{
|
||||
$sql .= ", date_commande = now()";
|
||||
$sql .= ",fk_user_commande=".$user->id;
|
||||
}
|
||||
|
||||
$sql .= " WHERE rowid =".$this->id;
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
if ($datea)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut";
|
||||
$sql .= " (tms,fk_ligne, fk_user, statut, comment) ";
|
||||
$sql .= " VALUES ($datea,$this->id, $user->id, $statut, '$commentaire' )";
|
||||
|
||||
$this->db->query($sql);
|
||||
/*
|
||||
* Mise à jour des logs
|
||||
*
|
||||
*/
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_ligne_statistique";
|
||||
$sql .= " SET nb = nb - 1";
|
||||
$sql .= " WHERE statut = ".$this->statut;
|
||||
$sql .= " AND dates >= '".$datea ."'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_ligne_statistique";
|
||||
$sql .= " SET nb = nb + 1";
|
||||
$sql .= " WHERE statut = ".$statut;
|
||||
$sql .= " AND dates >= '".$datea ."'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut";
|
||||
$sql .= " (tms, fk_ligne, fk_user, statut, comment) ";
|
||||
$sql .= " VALUES (now(), $this->id, $user->id, $statut, '$commentaire' )";
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT distinct statut, count(*) FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne GROUP BY statut";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
$i = 0;
|
||||
$sl = array();
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($i);
|
||||
$sl[$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
/* Nettoyage des logs */
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_ligne_statistique";
|
||||
$sql .= " WHERE dates = now()";
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
print $sql;
|
||||
}
|
||||
|
||||
/* Insertion des nouveaux logs */
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $sl[$i];
|
||||
|
||||
$sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_ligne_statistique";
|
||||
$sql .= " VALUES (now(),".$row[0].",".$row[1].")";
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
print $sql;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $sql;
|
||||
}
|
||||
|
||||
$this->log_clients();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function log_clients()
|
||||
{
|
||||
$sql = "SELECT distinct s.idp ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE l.statut = 3 AND s.idp = l.fk_soc ";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
$nbclients = $num;
|
||||
$i = 0;
|
||||
|
||||
/* Insertion des nouveaux logs */
|
||||
|
||||
$sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_client_statistique";
|
||||
$sql .= " VALUES (now(),'nbclient',".$num.")";
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
print $sql;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $sql;
|
||||
}
|
||||
/*
|
||||
* nbligne active / client
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT count(*) ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
|
||||
$sql .= " WHERE l.statut = 3";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
|
||||
$row = $this->db->fetch_row(0);
|
||||
|
||||
/* Insertion des nouveaux logs */
|
||||
|
||||
if ($nbclients > 0)
|
||||
{
|
||||
$nblapc = ereg_replace(",",".",round($row[0]/$nbclients,3));
|
||||
}
|
||||
|
||||
$sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_client_statistique";
|
||||
$sql .= " VALUES (now(),'nblapc','".$nblapc."')";
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
print $sql;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $sql;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function add_contact($cid)
|
||||
{
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_contact_facture";
|
||||
$sql .= " (fk_ligne, fk_contact) ";
|
||||
$sql .= " VALUES ($this->id, $cid )";
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function del_contact($cid)
|
||||
{
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_contact_facture";
|
||||
$sql .= " WHERE fk_ligne=$this->id AND fk_contact=$cid ;";
|
||||
|
||||
return $this->db->query($sql);
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
function get_contact_facture()
|
||||
{
|
||||
$this->contact_facture_id = array();
|
||||
$res = array();
|
||||
$resid = array();
|
||||
|
||||
|
||||
$sql = "SELECT c.idp, c.name, c.firstname, c.email ";
|
||||
$sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql .= ",".MAIN_DB_PREFIX."telephonie_contact_facture as cf";
|
||||
$sql .= " WHERE c.idp = cf.fk_contact AND cf.fk_ligne = ".$this->id." ORDER BY name ";
|
||||
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
$num = $this->db->num_rows();
|
||||
if ( $num > 0 )
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($i);
|
||||
|
||||
array_push($res, $row[1] . " " . $row[2] . " <".$row[3].">");
|
||||
array_push($resid, $row[0]);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->db->free();
|
||||
}
|
||||
|
||||
}
|
||||
$this->contact_facture_id = $resid;
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* Recupére le numéro d'une ligne depuis une facture comptable
|
||||
*
|
||||
*/
|
||||
|
||||
function fetch_by_facture_number($facnumber)
|
||||
{
|
||||
$sql = "SELECT fk_ligne, fk_facture ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture";
|
||||
$sql .= " WHERE fk_facture = ".$facnumber;
|
||||
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$row = $this->db->fetch_row(0);
|
||||
|
||||
$this->id = $row[0];
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
64
htdocs/telephonie/pre.inc.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?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$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
require("../main.inc.php");
|
||||
require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");
|
||||
$user->getrights('telephonie');
|
||||
|
||||
function llxHeader($head = "", $title="") {
|
||||
global $user, $conf;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
top_menu($head, $title);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation");
|
||||
$menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire");
|
||||
|
||||
if ($user->admin)
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/config/", "Configuration");
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
?>
|
||||