| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?PHP 2 /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id: factures.php,v 1.5 2005/09/07 08:27:07 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/ligne/factures.php,v $ 20 * 21 */ 22 23 require ("./pre.inc.php"); 24 25 $mesg = ''; 26 27 require_once DOL_DOCUMENT_ROOT."/facture.class.php"; 28 29 llxHeader("","","Fiche Ligne"); 30 31 if ($_GET["id"] or $_GET["numero"]) 32 { 33 if ($_GET["action"] <> 're-edit') 34 { 35 $ligne = new LigneTel($db); 36 if ($_GET["id"]) 37 { 38 $result = $ligne->fetch_by_id($_GET["id"]); 39 } 40 if ($_GET["numero"]) 41 { 42 $result = $ligne->fetch($_GET["numero"]); 43 } 44 } 45 46 47 if ($result == 1) 48 { 49 $client_comm = new Societe($db); 50 $client_comm->fetch($ligne->client_comm_id, $user); 51 } 52 53 if (!$client_comm->perm_read) 54 { 55 print "Lecture non authorisée"; 56 } 57 58 59 if ($result == 1 && $client_comm->perm_read) 60 { 61 62 $h=0; 63 $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id; 64 $head[$h][1] = $langs->trans("Ligne"); 65 $h++; 66 67 $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id; 68 $head[$h][1] = $langs->trans('Factures'); 69 $hselected = $h; 70 $h++; 71 72 /* 73 $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/facturesdet.php?id=".$ligne->id; 74 $head[$h][1] = $langs->trans('Factures détaillées'); 75 $h++; 76 */ 77 78 $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id; 79 $head[$h][1] = $langs->trans('Infos'); 80 $h++; 81 82 $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id; 83 $head[$h][1] = $langs->trans('Historique'); 84 $h++; 85 86 $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id; 87 $head[$h][1] = $langs->trans('Conso'); 88 $h++; 89 90 $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id; 91 $head[$h][1] = $langs->trans('Stats'); 92 $h++; 93 94 95 $sql = "SELECT f.fk_facture"; 96 $sql .= " ,s.nom, s.idp"; 97 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; 98 $sql .= " , ".MAIN_DB_PREFIX."societe as s"; 99 $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; 100 $sql .= " WHERE s.idp = l.fk_soc_facture AND l.rowid = f.fk_ligne"; 101 $sql .= " AND f.ligne ='".$ligne->numero."'"; 102 $sql .= " ORDER BY f.fk_facture DESC"; 103 104 $i = 1; 105 $facs = array(); 106 $result = $db->query($sql); 107 if ($result) 108 { 109 $num = $db->num_rows(); 110 111 while ($i < ($num+1)) 112 { 113 $row = $db->fetch_row(); 114 115 $facs[$i] = $row[0]; 116 117 $i++; 118 } 119 } 120 else 121 { 122 print $sql; 123 } 124 125 126 if ($_GET["facnum"]) 127 { 128 $facnum = $_GET["facnum"]; 129 } 130 else 131 { 132 $facnum = 1; 133 } 134 135 dolibarr_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero); 136 137 print_fiche_titre('Factures Ligne', $mesg); 138 139 print '<table class="border" width="100%" cellspacing="0" cellpadding="4">'; 140 141 print '<tr><td width="25%">Numéro</td><td>'.dolibarr_print_phone($ligne->numero).'</td>'; 142 print '<td>'; 143 144 if ($facnum > 1) 145 { 146 print '<a href="factures.php?id='.$ligne->id.'&facnum='.($facnum-1).'">'; 147 print '<- Facture précédente</a>'; 148 } 149 150 print " </td><td>"; 151 152 if ($facnum < sizeof($facs)) 153 { 154 print '<a href="factures.php?id='.$ligne->id.'&facnum='.($facnum+1).'">'; 155 print 'Facture suivante -></a>'; 156 } 157 158 print ' </td></tr>'; 159 160 $client = new Societe($db, $ligne->client_id); 161 $client->fetch($ligne->client_id); 162 163 print '<tr><td width="25%">Client</td><td>'; 164 165 print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$ligne->client_id.'">'; 166 print $client->nom.'</a></td>'; 167 168 $client_facture = new Societe($db); 169 $client_facture->fetch($ligne->client_facture_id); 170 171 print '<td width="25%">Client Facturé</td><td>'.$client_facture->nom.'</td></tr>'; 172 173 $fac = new Facture($db); 174 $fac->fetch($facs[$facnum]); 175 176 print '<tr><td>Facture</td><td colspan="3"><a href="'.DOL_URL_ROOT.'/telephonie/client/facture.php?facid='.$fac->id.'">'.$fac->ref.'</a></td></tr>'; 177 178 print "</table>\n"; 179 180 /* 181 * 182 * 183 * 184 */ 185 186 $file = DOL_DATA_ROOT."/facture/".$fac->ref."/".$fac->ref.".pdf"; 187 $file_img = DOL_DATA_ROOT."/facture/".$fac->ref."/".$fac->ref.".pdf.png"; 188 189 if (file_exists($file_img)) 190 { 191 print '<br><img src="../showfacture.php?uid='.$user->id.'&facref='.$fac->id.'"></img>'; 192 } 193 else 194 { 195 if (file_exists("/usr/bin/convert")) 196 { 197 exec("/usr/bin/convert $file $file_img"); 198 199 if (file_exists($file_img)) 200 { 201 print '<br><img src="../showfacture.php?uid='.$user->id.'&facref='.$fac->id.'"></img>'; 202 } 203 else 204 { 205 print "Erreur "; 206 } 207 } 208 } 209 } 210 } 211 else 212 { 213 print "Error"; 214 } 215 216 $db->close(); 217 218 llxFooter("<em>Dernière modification $Date: 2005/09/07 08:27:07 $ révision $Revision: 1.5 $</em>"); 219 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
|