Nouveau fichier

This commit is contained in:
Rodolphe Quiedeville 2004-12-03 13:32:34 +00:00
parent 92e45755d7
commit 2282eaed40
4 changed files with 529 additions and 0 deletions

View File

@ -0,0 +1,203 @@
<?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"];
$sortfield = $_GET["sortfield"];
llxHeader();
/*
* Sécurité accés client
*/
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
if ($sortorder == "") {
$sortorder="DESC";
}
if ($sortfield == "") {
$sortfield="f.date";
}
if ($page == -1) { $page = 0 ; }
/*
* Mode Liste
*
*
*
*/
$sql = "SELECT distinct(client), sum(montant) ";
$sql .= " FROM stragex";
if ($_GET["search_ligne"])
{
$sql .= " WHERE f.ligne LIKE '%".$_GET["search_ligne"]."%'";
}
$sql .= " GROUP BY client";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$i = 0;
print_barre_liste("Vérification avant facturation", $page, "check.php", "", $sortfield, $sortorder, '', $num);
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td valign="center">Ligne';
print '</td><td align="center">Client</td><td align="center">Client facturé</td><td align="right">Montant</td><td align="center">Remise LMN</td>';
print '<td align="center">RIB';
print '</td><td align="center">Email</td>';
print "</tr>\n";
$var=True;
$total = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
$var=!$var;
$total = $total + $row[1];
print "<tr $bc[$var]><td>";
$ligne = new LigneTel($db);
if ($ligne->fetch($row[0]) == 1)
{
print '<img src="../ligne/graph'.$ligne->statut.'.png">&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/telephonie/ligne/fiche.php?numero='.$row[0].'">';
print img_file();
print '</a>&nbsp;<a href="'.DOL_URL_ROOT.'/telephonie/ligne/fiche.php?numero='.$row[0].'">';
print dolibarr_print_phone($row[0])."</a></td>\n";
print '<td align="center">';
$client = new Societe($db);
if ($client->fetch($ligne->client_id))
{
print $client->nom."</td>\n";
}
else
{
print "Erreur";
}
print '<td align="center">';
if ($ligne->facturable)
{
$clientf = new Societe($db);
if ($clientf->fetch($ligne->client_facture_id))
{
print '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$ligne->client_facture_id.'">';
print $clientf->nom."</a></td>\n";
print '<td align="right">'.price($row[1])."</td>";;
/* Remise LMN */
print '<td align="center">'.$ligne->remise.' %</td>';
print '<td align="center">';
if ($ligne->mode_paiement == 'pre')
{
if ($clientf->verif_rib())
{
print 'ok';
}
else
{
print "Alerte RIB";
}
}
else
{
print 'Virement';
}
print "</td>\n";
}
else
{
print "Erreur</td><td>-</td>";
}
print '<td align="center">';
$cfs = $ligne->get_contact_facture();
if (sizeof($cfs))
{
print $cfs[0];
}
else
{
print "Alerte Emails";
}
print "</td>\n";
}
else
{
print 'Client non facturé</td><td colspan="4">&nbsp;</td>';
}
}
else
{
print dolibarr_print_phone($row[0]);
print '<td align="center">Ligne inconnue</td>';
print '<td colspan="5">&nbsp;</td>';
}
print "</tr>\n";
$i++;
}
print '<tr class="liste_titre"><td colspan="2">&nbsp;</td><td align="center">Total HT</td><td align="right">'.price($total).'</td><td colspan="4">&nbsp;</td>';
print "</tr>\n";
print '<tr class="liste_titre"><td colspan="2">&nbsp;</td><td align="center">Total TTC</td><td align="right">'.price($total*1.196).'</td><td colspan="4">&nbsp;</td>';
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,167 @@
<?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"];
$sortfield = $_GET["sortfield"];
llxHeader();
/*
* Sécurité accés client
*/
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
if ($sortorder == "") {
$sortorder="DESC";
}
if ($sortfield == "") {
$sortfield="f.date";
}
/*
* Recherche
*
*
*/
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* Mode Liste
*
*
*
*/
$sql = "SELECT f.rowid, f.date, f.ligne, f.fourn_montant, f.cout_vente, f.cout_vente_remise, f.gain, f.fk_facture";
$sql .= " ,s.nom, s.idp";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f";
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
$sql .= " WHERE s.idp = l.fk_soc_facture AND l.rowid = f.fk_ligne";
if ($_GET["search_ligne"])
{
$sql .= " AND f.ligne LIKE '%".$_GET["search_ligne"]."%'";
}
if ($_GET["search_client"])
{
$sql .= " AND s.nom LIKE '%".$_GET["search_client"]."%'";
}
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$i = 0;
print_barre_liste("Factures", $page, "liste.php", "", $sortfield, $sortorder, '', $num);
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Client","liste.php","s.nom");
print_liste_field_titre("Ligne","liste.php","l.ligne");
print '<td align="center">Date</td><td align="right">Montant HT</td>';
print '<td align="right">Coût fournisseur HT';
print '</td><td align="right">Gain</td><td align="center">Facture</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="liste.php" method="GET">';
print '<td><input type="text" name="search_client" size="20" value="'.$_GET["search_client"].'"></td>';
print '<td><input type="text" name="search_ligne" size="20" value="'.$_GET["search_ligne"].'"></td>';
print '<td><input type="submit" value="Chercher"></td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '</form>';
print '</tr>';
$var=True;
$ligne = new LigneTel($db);
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($i);
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->idp.'">';
print img_file();
print '</a>&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->idp.'">'.$obj->nom."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/telephonie/ligne/fiche.php?numero='.$obj->ligne.'">'.dolibarr_print_phone($obj->ligne)."</a></td>\n";
print '<td align="center">'.$obj->date."</td>\n";
print '<td align="right">'.sprintf("%01.4f",$obj->cout_vente_remise)."</td>\n";
print '<td align="right">'.sprintf("%01.4f",$obj->fourn_montant)."</td>\n";
print '<td align="right">';
if ($obj->gain < 0 && $obj->cout_vente_remise)
{
print '<font color="red"><b>';
print sprintf("%01.4f",$obj->gain);
print "</b></font>";
}
else
{
print sprintf("%01.4f",$obj->gain);
}
print "</td>\n";
print '<td align="center"><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->fk_facture.'">'.$obj->fk_facture."</a></td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,125 @@
<?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">';
$sql = "SELECT date_format(f.datef,'%Y%m'), sum(f.total_ttc)";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf";
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
$sql .= " WHERE tf.fk_facture = f.rowid";
$sql .= " GROUP BY date_format(f.datef,'%Y%m')";
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>Factures</td><td valign="center">Nb</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$row = $db->fetch_row($i);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".$row[0]."</td>\n";
print "<td>".$row[1]."</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
print '</td><td valign="top" width="70%" rowspan="3">';
print '</td></tr>';
print '<tr><td width="30%" valign="top">';
/*
*
*
*/
/*
*
*
*/
print '</td></tr>';
print '</table>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,34 @@
-- ========================================================================
-- 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$
--
-- ========================================================================
create table llx_telephonie_import_cdr (
ligne int,
client varchar(255),
date varchar(255),
heure varchar(255),
num varchar(255),
dest varchar(255),
dureetext varchar(255),
tarif varchar(255),
montant real,
duree integer
)type=innodb;