diff --git a/htdocs/telephonie/contrat/services.php b/htdocs/telephonie/contrat/services.php new file mode 100644 index 00000000000..dc9405db759 --- /dev/null +++ b/htdocs/telephonie/contrat/services.php @@ -0,0 +1,339 @@ + + * + * 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 = ''; + +if ($_POST["action"] == 'addservice') +{ + $contrat = new TelephonieContrat($db); + $contrat->id= $_GET["id"]; + + if ( $contrat->add_service($user, $_POST["service_id"]) == 0) + { + Header("Location: services.php?id=".$contrat->id); + } +} + +if ($_POST["action"] == 'rmservice') +{ + $contrat = new TelephonieContrat($db); + $contrat->id= $_GET["id"]; + + if ( $contrat->remove_service($user, $_POST["service_id"]) == 0) + { + Header("Location: services.php?id=".$contrat->id); + } +} + +llxHeader("","","Fiche Contrat - Services"); + +if ($cancel == $langs->trans("Cancel")) +{ + $action = ''; +} + + + if ($_GET["id"]) + { + if ($_GET["action"] <> 're-edit') + { + $contrat = new TelephonieContrat($db); + + if ($contrat->fetch($_GET["id"]) == 0) + { + $result = 1; + } + } + + if ( $result ) + { + if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') + { + + $h=0; + $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id; + $head[$h][1] = $langs->trans("Contrat"); + $h++; + + $nser = $contrat->count_associated_services(); + + $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/services.php?id=".$contrat->id; + if ($nser > 0) + { + $head[$h][1] = $langs->trans("Services")." (".$nser.")"; + } + else + { + $head[$h][1] = $langs->trans("Services"); + } + $hselected = $h; + $h++; + + dolibarr_fiche_head($head, $hselected, 'Contrat : '.$contrat->ref); + + print_fiche_titre('Fiche Contrat', $mesg); + + print '
| Référence | '.$contrat->ref.' | '; + print 'Facturé : '.$contrat->facturable.' |
| Client | '; + print ''; + + print $client_comm->nom.' | '.$client_comm->code_client; + print ' |
| Client (Agence/Filiale) | ';
+ print $client->nom.' '; + + print $client->cp . " " .$client->ville; + print ' | |
| Client Facturé | ';
+ print $client_facture->nom.' '; + print $client_facture->cp . " " .$client_facture->ville; + + print ' | '; + + if ($contrat->mode_paiement == 'pre') + { + print 'RIB : '.$client_facture->display_rib(); + } + else + { + print 'Paiement par virement'; + } + + print ' |
| Commercial Signature | '; + print ''.$commercial->fullname.' | |
| Commercial Suivi | '; + print ''.$commercial_suiv->fullname.' | |
| Contact facture | '; + print '';
+
+ $sql = "SELECT c.idp, c.name, c.firstname, c.email ";
+ $sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c";
+ $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_contact_facture as cf";
+ $sql .= " WHERE c.idp = cf.fk_contact AND cf.fk_contrat = ".$contrat->id." ORDER BY name ";
+ if ( $db->query( $sql) )
+ {
+ $num = $db->num_rows();
+ if ( $num > 0 )
+ {
+ $i = 0;
+ while ($i < $num)
+ {
+ $row = $db->fetch_row($i);
+
+ print $row[1] . " " . $row[2] . " <".$row[3]."> "; + $i++; + } + } + $db->free(); + + } + else + { + print $sql; + } + print ' | |
| Service | '; + print 'Montant | '; + print " |
";
+
+ print ' ';
+
+
+ print ''.$obj->libelle." | \n";
+
+ print ''.price($obj->montant)." euros HT | \n"; + + print ''; + print img_delete(); + print " | "; + print "