From 851e3fe89196999fe929a2599c7a545b38118f31 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 8 Apr 2005 07:56:35 +0000 Subject: [PATCH] Synchro --- htdocs/telephonie/client/my.php | 7 ++- htdocs/telephonie/contrat/fiche.php | 4 -- htdocs/telephonie/contrat/stats.php | 50 +++++++++---------- htdocs/telephonie/ligne/factures.php | 4 ++ htdocs/telephonie/ligne/history.php | 21 ++++++++ .../telephonie/script/facturation-details.php | 19 ++++--- .../script/facturation-emission.php | 8 +-- .../facture-detail-tableur-one.class.php | 3 +- htdocs/telephonie/script/graph-contrat.php | 2 +- htdocs/telephonie/service/fiche.php | 36 ++++++------- htdocs/telephonie/service/index.php | 18 ++++--- htdocs/telephonie/service/pre.inc.php | 2 - .../telephonie/stats/commerciaux/pre.inc.php | 25 +--------- .../stats/communications/pre.inc.php | 29 +---------- 14 files changed, 102 insertions(+), 126 deletions(-) diff --git a/htdocs/telephonie/client/my.php b/htdocs/telephonie/client/my.php index 8012cf093dc..dc2b301e788 100644 --- a/htdocs/telephonie/client/my.php +++ b/htdocs/telephonie/client/my.php @@ -89,7 +89,11 @@ if ($result) $urladd= "&statut=".$_GET["statut"]; - print_barre_liste("Les clients de ".$user->fullname, $page, "my.php", $urladd, $sortfield, $sortorder, '', $num); + $titre = "Les clients de ".$user->fullname; + + print_barre_liste($titre, $page, "my.php", $urladd, $sortfield, $sortorder, '', $num); + + print 'Exporter dans un tableur'; print ''; print ''; @@ -106,7 +110,6 @@ if ($result) print ''; print ''; - $var=True; $ligne = new LigneTel($db); diff --git a/htdocs/telephonie/contrat/fiche.php b/htdocs/telephonie/contrat/fiche.php index 87d92337500..10551491066 100644 --- a/htdocs/telephonie/contrat/fiche.php +++ b/htdocs/telephonie/contrat/fiche.php @@ -74,8 +74,6 @@ if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) } } - - if ($_POST["action"] == 'addcontact') { $contrat = new TelephonieContrat($db); @@ -98,8 +96,6 @@ if ($_GET["action"] == 'delcontact') } } - - if ($_GET["action"] == 'delete') { $contrat = new TelephonieContrat($db); diff --git a/htdocs/telephonie/contrat/stats.php b/htdocs/telephonie/contrat/stats.php index 1b4dfb449eb..cc24d7fce3e 100644 --- a/htdocs/telephonie/contrat/stats.php +++ b/htdocs/telephonie/contrat/stats.php @@ -76,33 +76,31 @@ if ($_GET["id"]) print_fiche_titre('Fiche Contrat', $mesg); - print '
'; - - $client_comm = new Societe($db, $contrat->client_comm_id); - $client_comm->fetch($contrat->client_comm_id); - - print ''; - print ''; - - print ''; - - $commercial = new User($db, $contrat->commercial_sign_id); - $commercial->fetch(); - $commercial_suiv = new User($db, $contrat->commercial_suiv_id); - $commercial_suiv->fetch(); - - print ''; - print ''; - - /* Fin Contacts */ - - print "
Référence'.$contrat->ref.'Facturé : '.$contrat->facturable.'
Client'; - print ''; - - print $client_comm->nom.''.$client_comm->code_client; - print '
Commercial Suivi/Signature'.$commercial_suiv->fullname.'/'.$commercial->fullname.'

"; - + print ''; + $client_comm = new Societe($db, $contrat->client_comm_id); + $client_comm->fetch($contrat->client_comm_id); + + print ''; + print ''; + + print ''; + + $commercial = new User($db, $contrat->commercial_sign_id); + $commercial->fetch(); + $commercial_suiv = new User($db, $contrat->commercial_suiv_id); + $commercial_suiv->fetch(); + + print ''; + print ''; + + print "
Référence'.$contrat->ref.'Facturé : '.$contrat->facturable.'
Client'; + print ''; + + print $client_comm->nom.''.$client_comm->code_client; + print '
Commercial Suivi/Signature'.$commercial_suiv->fullname.'/'.$commercial->fullname.'

"; + + print ''; print ''; print ''; diff --git a/htdocs/telephonie/ligne/factures.php b/htdocs/telephonie/ligne/factures.php index 2d9d70a3dc2..a7e6634454d 100644 --- a/htdocs/telephonie/ligne/factures.php +++ b/htdocs/telephonie/ligne/factures.php @@ -56,6 +56,10 @@ if ($_GET["id"] or $_GET["numero"]) $hselected = $h; $h++; + $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/facturesdet.php?id=".$ligne->id; + $head[$h][1] = $langs->trans('Factures détaillées'); + $h++; + $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; $head[$h][1] = $langs->trans('Infos'); $h++; diff --git a/htdocs/telephonie/ligne/history.php b/htdocs/telephonie/ligne/history.php index f76a27ed6de..da0e2784930 100644 --- a/htdocs/telephonie/ligne/history.php +++ b/htdocs/telephonie/ligne/history.php @@ -104,6 +104,27 @@ if ($cancel == $langs->trans("Cancel")) print $ligne->statuts[$ligne->statut]; print ''; + if ($ligne->user_creat) + { + print ''; + } + if ($ligne->user_commande) + { + print ''; + } + print ''; print ''; print ''; diff --git a/htdocs/telephonie/script/facturation-details.php b/htdocs/telephonie/script/facturation-details.php index 0ff641b7ea1..43b816f518b 100644 --- a/htdocs/telephonie/script/facturation-details.php +++ b/htdocs/telephonie/script/facturation-details.php @@ -107,6 +107,8 @@ if (!$error) if (!$error && sizeof($factures)) { + $facok = 0; + foreach ($factures as $facid) { $error = 0; @@ -116,13 +118,12 @@ if (!$error && sizeof($factures)) $factel = new FactureTel($db); if ($factel->fetch($facid) == 0) { - $objligne = new LigneTel($db); - + if ($objligne->fetch($factel->ligne) == 1) { // Différents modèles de factures détaillées - + $modele = "standard"; require_once (DOL_DOCUMENT_ROOT."/telephonie/pdf/pdfdetail_".$modele.".modules.php"); @@ -130,17 +131,21 @@ if (!$error && sizeof($factures)) $facdet = new $class($db, $ligne, $year, $month, $factel); - if (! $facdet->write_pdf_file($factel, $factel->ligne)) + if ($facdet->write_pdf_file($factel, $factel->ligne) == 0) + { + $facok++; + } + else { dolibarr_syslog("ERREUR lors de Génération du pdf détaillé"); $error = 19; } - } - } - } + + dolibarr_syslog(sizeof($factures)." factures traitées"); + dolibarr_syslog($facok." factures générées"); } $db->close(); diff --git a/htdocs/telephonie/script/facturation-emission.php b/htdocs/telephonie/script/facturation-emission.php index a763c206eea..749e8a7c487 100644 --- a/htdocs/telephonie/script/facturation-emission.php +++ b/htdocs/telephonie/script/facturation-emission.php @@ -213,7 +213,7 @@ if (!$error) if (sizeof($numlignes) > 0) { - _emails($db, $user, $factures_a_mailer); + _emails($db, $user, $contrat, $factures_a_mailer); } } @@ -599,9 +599,8 @@ function _prelevements($db, $user, $factures_prev) -function _emails($db, $user, $factures_a_mailer) +function _emails($db, $user, $contrat_id, $factures_a_mailer) { - /******************************************************************** * * * * @@ -619,6 +618,9 @@ function _emails($db, $user, $factures_a_mailer) $fact = new Facture($db); $fact->fetch($fac); + $contrat = new TelephonieContrat($db); + $contrat->fetch($contrat_id); + $ligne = new LigneTel($db); if ($ligne->fetch_by_facture_number($fact->id) == 0) diff --git a/htdocs/telephonie/script/facture-detail-tableur-one.class.php b/htdocs/telephonie/script/facture-detail-tableur-one.class.php index b259430e08d..25778f1b04c 100644 --- a/htdocs/telephonie/script/facture-detail-tableur-one.class.php +++ b/htdocs/telephonie/script/facture-detail-tableur-one.class.php @@ -37,7 +37,8 @@ class FactureDetailTableurOne { $dir = "/tmp"; $error = 0; - $fname = $dir."/".$this->ligne."-".substr('00'.$month, -2)."-".$year.".xls"; + $dir = FAC_OUTPUTDIR . "/" . $fac->ref . "/" ; + $file = $dir . $fac->ref . "-$ligne-$objlignetel->code_analytique-detail.xls"; dolibarr_syslog("Open $fname"); diff --git a/htdocs/telephonie/script/graph-contrat.php b/htdocs/telephonie/script/graph-contrat.php index 4c49df8d6be..88314893da7 100644 --- a/htdocs/telephonie/script/graph-contrat.php +++ b/htdocs/telephonie/script/graph-contrat.php @@ -27,6 +27,6 @@ require ("../../master.inc.php"); require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/ProcessGraphContrats.class.php"); $process = new ProcessGraphContrats( $childrenNow, $clientPerChild ); -$process->go("269"); +$process->go(269); ?> diff --git a/htdocs/telephonie/service/fiche.php b/htdocs/telephonie/service/fiche.php index d8383ee18d3..652ed68c6ae 100644 --- a/htdocs/telephonie/service/fiche.php +++ b/htdocs/telephonie/service/fiche.php @@ -48,15 +48,10 @@ if ($_POST["action"] == 'add') if ($_GET["action"] == 'active') { - $service = new LigneTel($db); - $service->fetch_by_id($_GET["id"]); + $service = new TelephonieService($db); + $service->id = $_GET["id"]; - $datea = $db->idate(mktime($h, $m , $s, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"])); - - if ( $service->set_statut($user, 3, $datea) == 0) + if ( $service->active($user) == 0) { Header("Location: fiche.php?id=".$service->id); } @@ -145,7 +140,7 @@ else $hselected = $h; $h++; - dolibarr_fiche_head($head, $hselected, 'Service : '.$service->numero); + dolibarr_fiche_head($head, $hselected, 'Service : '.$service->id); print_fiche_titre('Fiche Service', $mesg); @@ -154,7 +149,7 @@ else print ''; print ''; - print ''; + print ''; print ''; print "
Chiffre d\'affaireGain
Créé par'; + + $cuser = new User($db, $ligne->user_creat); + $cuser->fetch(); + + print $cuser->fullname; + print '
Commandé par'; + + $couser = new User($db, $ligne->user_commande); + $couser->fetch(); + + print $couser->fullname; + print '
DateStatut
Libellé'.$service->libelle.'
Libellé Facture'.$service->libelle_facture.'
Montant HT'.dolibarr_print_phone($service->montant).'
Montant mensuel HT'.$service->montant.'
Statut'.$service->statuts[$service->statut].'

"; print ''; @@ -195,24 +190,15 @@ else print ''; print ''; - print 'Montant HT'; + print 'Montant mensuel HT'; print '  euros HT'; print ''; - - print ''; - print ''; print ''; - /* - * - * - * - */ - print ''; } @@ -234,13 +220,19 @@ else print "\n
\n"; +if ($_GET["action"] == '' && $service->statut == 0) +{ + print "id\">".$langs->trans("Active").""; +} + + if ($_GET["action"] == '') { - print "id\">".$langs->trans("Edit").""; - } + + print "
"; diff --git a/htdocs/telephonie/service/index.php b/htdocs/telephonie/service/index.php index 0af337e1462..c1e2a2242d8 100644 --- a/htdocs/telephonie/service/index.php +++ b/htdocs/telephonie/service/index.php @@ -37,24 +37,27 @@ print ''; print '
'; -$sql = "SELECT libelle, montant "; +$sql = "SELECT s.rowid , libelle, count(cs.rowid) "; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_service as s"; - +$sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat_service as cs"; +$sql .= " WHERE cs.fk_service = s.rowid"; +$sql .= " GROUP by s.rowid DESC"; +//print $sql; if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; - print ''; - print ''; + print ''; print "\n"; $var=True; while ($i < min($num,$conf->liste_limit)) { - $obj = $db->fetch_object($i); - print ""; + $row = $db->fetch_row(); + print '"; + print '"; $i++; } @@ -69,10 +72,11 @@ else } print '
'; - +print ''; + print '
Libellé
Libellé-
".stripslashes($obj->libelle)."
'.stripslashes($row[1])."'.$row[2]."
 '; print '
'; diff --git a/htdocs/telephonie/service/pre.inc.php b/htdocs/telephonie/service/pre.inc.php index f2d152f6d8e..8c14b549952 100644 --- a/htdocs/telephonie/service/pre.inc.php +++ b/htdocs/telephonie/service/pre.inc.php @@ -57,8 +57,6 @@ function llxHeader($head = "", $title="") { - $menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire"); - left_menu($menu->liste); } diff --git a/htdocs/telephonie/stats/commerciaux/pre.inc.php b/htdocs/telephonie/stats/commerciaux/pre.inc.php index 4638990f9fb..0113ceba653 100644 --- a/htdocs/telephonie/stats/commerciaux/pre.inc.php +++ b/htdocs/telephonie/stats/commerciaux/pre.inc.php @@ -34,30 +34,7 @@ function llxHeader($head = "", $title="") { $menu = new Menu(); - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/index.php", "Contrats"); - - $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/stats/", "Statistiques"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/clients/", "Clients"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/commerciaux/", "Commerciaux"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/lignes/", "Lignes"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/communications/", "Communications"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/factures/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - $menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs"); - - $menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire"); + include "../menus.php"; left_menu($menu->liste); } diff --git a/htdocs/telephonie/stats/communications/pre.inc.php b/htdocs/telephonie/stats/communications/pre.inc.php index 171db97d2c0..0113ceba653 100644 --- a/htdocs/telephonie/stats/communications/pre.inc.php +++ b/htdocs/telephonie/stats/communications/pre.inc.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005 Rodolphe Quiedeville * * 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,7 +20,6 @@ * */ require("../../../main.inc.php"); -require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); $user->getrights('telephonie'); @@ -35,31 +34,7 @@ function llxHeader($head = "", $title="") { $menu = new Menu(); - $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); - - $menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients"); - - $menu->add(DOL_URL_ROOT."/telephonie/contrat/index.php", "Contrats"); - - $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/stats/", "Statistiques"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/clients/", "Clients"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/commerciaux/", "Commerciaux"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/lignes/", "Lignes"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/communications/", "Communications"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/fournisseurs/", "Fournisseurs"); - $menu->add_submenu(DOL_URL_ROOT."/telephonie/stats/factures/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures"); - - $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); - - $menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs"); - - $menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire"); + include "../menus.php"; left_menu($menu->liste); }