diff --git a/htdocs/telephonie/tarifs/fiche.php b/htdocs/telephonie/tarifs/fiche.php new file mode 100644 index 00000000000..abf141d5ce9 --- /dev/null +++ b/htdocs/telephonie/tarifs/fiche.php @@ -0,0 +1,152 @@ + + * + * 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"); + +$mesg = ''; + +llxHeader("","","Fiche Tarif"); + +if ($cancel == $langs->trans("Cancel")) +{ + $action = ''; +} +/* + * Affichage + * + */ +/* + * Création + * + */ + + +if ($_GET["id"]) +{ + + + $h=0; + $head[$h][0] = DOL_URL_ROOT."/telephonie/tarifs/fiche.php?id=".$soc->id; + $head[$h][1] = $langs->trans("Lignes"); + $hselected = $h; + $h++; + + dolibarr_fiche_head($head, $hselected, 'Tarif : '.$soc->nom); + + print ''; + print ''; + + print ""; + + print ''; + print ''; + print ''; + + print ''; + + print '
'.$langs->trans('Name').''.$soc->nom.''.$langs->trans('Prefix').''.$soc->prefix_comm.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
'.$langs->trans('Phone').''.dolibarr_print_phone($soc->tel).''.$langs->trans('Fax').''.dolibarr_print_phone($soc->fax).'
'.$langs->trans('Web').''; + if ($soc->url) { print 'http://'.$soc->url.''; } + print '
'.img_edit() ." "; + print $langs->trans('RIB').''; + print $soc->display_rib(); + print '

'; + + print ''; + + //print ''; + //print ''; + + /* Lignes */ + + $sql = "SELECT s.idp as socidp, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; + $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 .= " AND s.idp = ".$soc->id; + + if ( $db->query( $sql) ) + { + $num = $db->num_rows(); + if ( $num > 0 ) + { + $i = 0; + + $ligne = new LigneTel($db); + + print ''; + + print "\n"; + + while ($i < $num) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print "\n"; + + print '\n"; + + print '\n"; + print "\n"; + print "\n"; + $i++; + } + } + $db->free(); + + } + else + { + print $sql; + } + + print "
Numéro'.dolibarr_print_phone($ligne->numero).'Facturée : '.$ligne->facturable.'
Ligne'; + print 'StatutRemise LMN'; + print 'Fournisseur
"; + + print ' '; + + print ''; + print img_file(); + + print ' '; + + print ''.dolibarr_print_phone($obj->ligne)."'.$ligne->statuts[$obj->statut]."'.$obj->remise." %".$obj->fournisseur."
"; +} +else +{ + print "Error"; +} + + +print ''; + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/tarifs/tarif.php b/htdocs/telephonie/tarifs/tarif.php new file mode 100644 index 00000000000..caf929412a4 --- /dev/null +++ b/htdocs/telephonie/tarifs/tarif.php @@ -0,0 +1,202 @@ + + * + * 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"); + +llxHeader(); + +/* + * Sécurité accés client + */ +if ($user->societe_id > 0) +{ + $action = ''; + $socidp = $user->societe_id; +} + + + +/* + * Recherche + * + * + */ +if ($mode == 'search') { + if ($mode-search == 'soc') { + $sql = "SELECT s.idp FROM ".MAIN_DB_PREFIX."societe as s "; + $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; + } + + if ( $db->query($sql) ) { + if ( $db->num_rows() == 1) { + $obj = $db->fetch_object(0); + $socid = $obj->idp; + } + $db->free(); + } +} + +$page = $_GET["page"]; +$sortorder = $_GET["sortorder"]; +$sortfield = $_GET["sortfield"]; + +if ($sortorder == "") $sortorder="ASC"; +if ($sortfield == "") $sortfield="t.libelle ASC, d.rowid "; + +$offset = $conf->liste_limit * $page ; + +/* + * Mode Liste + * + * + * + */ +print '
'; + +$sql = "SELECT d.libelle as tarif_desc, d.type_tarif"; +$sql .= " , t.libelle as tarif"; +$sql .= " , m.temporel, m.fixe"; +$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; +$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; +$sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; + +$sqlc .= " WHERE d.rowid = m.fk_tarif_desc"; +$sqlc .= " AND m.fk_tarif = t.rowid"; + + +$sqlc .= " AND t.rowid = '".$_GET["id"]."'"; + + +if ($_GET["search_libelle"]) +{ + $sqlc .=" AND t.libelle LIKE '%".$_GET["search_libelle"]."%'"; +} + +if ($_GET["search_prefix"]) +{ + $sqlc .=" AND tf.prefix LIKE '%".$_GET["search_prefix"]."%'"; +} + +if ($_GET["type"]) +{ + $sqlc .= " AND d.type_tarif = '".$_GET["type"]."'"; +} + + +$sql = $sql . $sqlc . " ORDER BY $sortfield $sortorder"; + +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows(); + $i = 0; + + print ''; + print ''; + + print_liste_field_titre("Tarif","index.php","d.libelle"); + + print_liste_field_titre("Destination","index.php","t.libelle", "&type=".$_GET["type"]); + + print_liste_field_titre("Cout / min","index.php","temporel", "&type=".$_GET["type"]); + print ""; + print ""; + print ""; + print "\n"; + + $var=True; + + while ($i < $num) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print ""; + + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
Cout fixeType
".$obj->tarif_desc."".$obj->tarif."".sprintf("%01.4f",$obj->temporel)."".sprintf("%01.4f",$obj->fixe)."".$obj->type_tarif."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + + + +print '
'; + +$sql = "SELECT prefix"; +$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_prefix"; + +$sql .= " WHERE fk_tarif = ".$_GET["id"]; +$sql .= " ORDER BY prefix ASC"; + +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows(); + $i = 0; + + print ''; + print ''; + print ''; + print "\n"; + + $var=True; + + while ($i < $num) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print ""; + + print "\n"; + + print "\n"; + $i++; + } + print "
Prefix
".$obj->prefix."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + +print '
'; + + + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>