[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2003 Éric Seigne <erics@rycks.com> 4 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 20 * $Id: fiche.php,v 1.53 2005/12/05 20:52:43 eldy Exp $ 21 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/fourn/fiche.php,v $ 22 */ 23 24 /** 25 \file htdocs/fourn/fiche.php 26 \ingroup fournisseur, facture 27 \brief Page de fiche fournisseur 28 \version $Revision: 1.53 $ 29 */ 30 31 require ('./pre.inc.php'); 32 33 $langs->load('suppliers'); 34 $langs->load('products'); 35 $langs->load('bills'); 36 $langs->load('orders'); 37 $langs->load('companies'); 38 39 $socid = $_GET['socid']; 40 /* 41 * Sécurité accés client 42 */ 43 if ($user->societe_id > 0) 44 { 45 $action = ''; 46 $socid = $user->societe_id; 47 } 48 49 50 /* 51 * Mode fiche 52 */ 53 $societe = new Fournisseur($db); 54 55 if ( $societe->fetch($socid) ) 56 { 57 $addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid; 58 $addons[0][1] = $societe->nom; 59 60 llxHeader('',$langs->trans('SupplierCard').' : '.$societe->nom, $addons); 61 62 /* 63 * Affichage onglets 64 */ 65 $h = 0; 66 67 $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$socid; 68 $head[$h][1] = $langs->trans('Company'); 69 $h++; 70 71 if ($societe->client==1) 72 { 73 $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$socid; 74 $head[$h][1] = $langs->trans('Customer'); 75 $h++; 76 } 77 if ($societe->client==2) 78 { 79 $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$socid; 80 $head[$h][1] = $langs->trans('Prospect'); 81 $h++; 82 } 83 if ($societe->fournisseur) 84 { 85 $hselected=$h; 86 $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid; 87 $head[$h][1] = $langs->trans('Supplier'); 88 $h++; 89 } 90 91 if ($conf->compta->enabled) { 92 $langs->load('compta'); 93 $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$socid; 94 $head[$h][1] = $langs->trans('Accountancy'); 95 $h++; 96 } 97 98 $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; 99 $head[$h][1] = $langs->trans('Note'); 100 $h++; 101 102 if ($user->societe_id == 0) 103 { 104 $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; 105 $head[$h][1] = $langs->trans('Documents'); 106 $h++; 107 } 108 109 $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; 110 $head[$h][1] = $langs->trans('Notifications'); 111 $h++; 112 113 $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id; 114 $head[$h][1] = $langs->trans("Info"); 115 $h++; 116 117 dolibarr_fiche_head($head, $hselected, $societe->nom); 118 119 /* 120 * 121 * 122 */ 123 124 print '<table width="100%">'; 125 print '<tr><td valign="top" width="50%">'; 126 127 print '<table class="border" width="100%">'; 128 print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>'; 129 130 print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$societe->prefix_comm.'</td></tr>'; 131 132 /* 133 if ($societe->client) { 134 print '<tr><td>'; 135 print $langs->trans('CustomerCode').'</td><td colspan="3">'; 136 print $societe->code_client; 137 if ($societe->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); 138 print '</td></tr>'; 139 } 140 */ 141 142 if ($societe->fournisseur) { 143 print '<tr><td>'; 144 print $langs->trans('SupplierCode').'</td><td colspan="3">'; 145 print $societe->code_fournisseur; 146 if ($societe->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode"); 147 print '</td></tr>'; 148 print '<tr>'; 149 print '<td nowrap>'.$langs->trans("SupplierAccountancyCode").'</td><td colspan="3">'.$societe->code_compta_fournisseur.'</td>'; 150 print '</tr>'; 151 } 152 153 print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->adresse).'</td></tr>'; 154 155 print '<tr><td>'.$langs->trans("Zip").'</td><td>'.$societe->cp.'</td>'; 156 print '<td>'.$langs->trans("Town").'</td><td>'.$societe->ville.'</td></tr>'; 157 print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">'.$societe->pays.'</td></tr>'; 158 print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dolibarr_print_phone($societe->tel).' </td><td>'.$langs->trans("Fax").'</td><td>'.dolibarr_print_phone($societe->fax).' </td></tr>'; 159 print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a> </td></tr>"; 160 161 print "<tr><td nowrap>".$langs->transcountry("ProfId1",$societe->pays_code)."</td><td><a href=\"http://www.societe.com/cgi-bin/recherche?rncs=".$societe->siren."\">".$societe->siren."</a> </td>"; 162 print '<td>'.$langs->transcountry('ProfId2',$societe->pays_code).'</td><td>'.$societe->siret.'</td></tr>'; 163 164 print '<tr><td>'.$langs->transcountry('ProfId3',$societe->pays_code).'</td><td>'.$societe->ape.'</td><td colspan="2"> </td></tr>'; 165 166 // Statut juridique 167 print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$societe->forme_juridique.'</td></tr>'; 168 169 // Type + Staff 170 $arr = $societe->typent_array($societe->typent_id); 171 $societe->typent= $arr[$societe->typent_id]; 172 print '<tr><td>'.$langs->trans("Type").'</td><td>'.$societe->typent.'</td><td>'.$langs->trans("Staff").'</td><td>'.$societe->effectif.'</td></tr>'; 173 174 print '</table>'; 175 176 177 /* 178 * 179 */ 180 181 print '</td><td valign="top" width="50%">'; 182 183 184 $var=true; 185 186 /* 187 * Liste des produits 188 */ 189 if ($conf->produit->enabled || $conf->service->enabled) 190 { 191 $langs->load("products"); 192 print '<table class="noborder" width="100%">'; 193 print '<tr class="liste_titre">'; 194 print '<td>'.$langs->trans("ProductsAndServices").'</td><td align="right">'; 195 print '<a href="'.DOL_URL_ROOT.'/fourn/product/liste.php?fourn_id='.$societe->id.'">'.$langs->trans("All").' ('.$societe->NbProduct().')'; 196 print '</a></td></tr></table><br>'; 197 } 198 199 /* 200 * Liste des commandes associées 201 */ 202 $max=4; 203 204 $sql = "SELECT p.rowid,p.ref,".$db->pdate("p.date_commande")." as dc, p.fk_statut"; 205 $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; 206 $sql.= " WHERE p.fk_soc =".$societe->id; 207 $sql.= " ORDER BY p.rowid"; 208 $sql.= " ".$db->plimit($max); 209 $resql=$db->query($sql); 210 if ($resql) 211 { 212 $i = 0 ; 213 $num = $db->num_rows($resql); 214 if ($num > 0) 215 { 216 print '<table class="noborder" width="100%">'; 217 print '<tr class="liste_titre">'; 218 print '<td colspan="3">'; 219 print '<table class="noborder" width="100%"><tr><td>'.$langs->trans("LastOrders",min($num,$max)).'</td>'; 220 print '<td align="right"><a href="commande/liste.php?socid='.$societe->id.'">'.$langs->trans("AllOrders").' ('.$num.')</td></tr></table>'; 221 print '</td></tr>'; 222 } 223 while ($i < $num && $i <= $max) 224 { 225 $obj = $db->fetch_object($resql); 226 $var=!$var; 227 228 print "<tr $bc[$var]>"; 229 print '<td><a href="commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref.'</a></td>'; 230 print '<td align="center" width="80">'; 231 if ($obj->dc) 232 { 233 print dolibarr_print_date($obj->dc); 234 } 235 else 236 { 237 print "-"; 238 } 239 print '</td>'; 240 print '<td width="20"><img src="commande/statut'.$obj->fk_statut.'.png"></td>'; 241 print '</tr>'; 242 $i++; 243 } 244 $db->free($resql); 245 if ($num > 0) 246 { 247 print "</table><br>"; 248 } 249 } 250 else 251 { 252 dolibarr_print_error($db); 253 } 254 255 256 /* 257 * Liste des factures associées 258 */ 259 $langs->load('bills'); 260 $max=5; 261 $sql = 'SELECT p.rowid,p.libelle,p.facnumber,p.fk_statut,'.$db->pdate('p.datef').' as df, total_ttc as amount, paye'; 262 $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as p'; 263 $sql.= ' WHERE p.fk_soc = '.$societe->id; 264 $sql.= ' ORDER BY p.datef DESC'; 265 $resql=$db->query($sql); 266 if ($resql) 267 { 268 $i = 0 ; 269 $num = $db->num_rows($resql); 270 if ($num > 0) 271 { 272 print '<table class="noborder" width="100%">'; 273 print '<tr class="liste_titre">'; 274 print '<td colspan="4">'; 275 print '<table class="noborder" width="100%"><tr><td>'.$langs->trans('LastSuppliersBills',min($num,$max)).'</td><td align="right"><a href="facture/index.php?socid='.$societe->id.'">'.$langs->trans('AllBills').' ('.$num.')</td></tr></table>'; 276 print '</td></tr>'; 277 } 278 $facturestatic = new FactureFournisseur($db); 279 while ($i < min($num,$max)) 280 { 281 $obj = $db->fetch_object($resql); 282 $var=!$var; 283 print '<tr '.$bc[$var].'>'; 284 print '<td>'; 285 print '<a href="facture/fiche.php?facid='.$obj->rowid.'">'; 286 print img_object($langs->trans('ShowBill'),'bill').' '.$obj->facnumber.'</a> '.dolibarr_trunc($obj->libelle,14).'</td>'; 287 print '<td align="center" width="80">'.dolibarr_print_date($obj->df).'</td>'; 288 print '<td align="right">'.price($obj->amount).'</td>'; 289 print '<td align="center">'.$facturestatic->LibStatutShort($obj->paye,$obj->fk_statut).'</td>'; 290 print '</tr>'; 291 $i++; 292 } 293 $db->free($resql); 294 if ($num > 0) 295 { 296 print '</table><br>'; 297 } 298 } 299 else 300 { 301 dolibarr_print_error($db); 302 } 303 304 /* 305 * 306 * 307 */ 308 print '</td></tr>'; 309 print '</table>' . "\n"; 310 print '</div>'; 311 312 /* 313 * 314 * Barre d'actions 315 * 316 */ 317 318 print '<div class="tabsAction">'; 319 320 if ($user->rights->fournisseur->commande->creer) 321 { 322 $langs->load("orders"); 323 print '<a class="tabAction" href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?action=create&socid='.$societe->id.'">'.$langs->trans("AddOrder").'</a>'; 324 } 325 326 if ($user->rights->fournisseur->facture->creer) 327 { 328 $langs->load("bills"); 329 print '<a class="tabAction" href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?action=create&socid='.$societe->id.'">'.$langs->trans("AddBill").'</a>'; 330 } 331 print '</div>'; 332 333 /* 334 * 335 * Liste des contacts 336 * 337 */ 338 $langs->load("companies"); 339 340 print '<br><table class="noborder" width="100%">'; 341 342 print '<tr class="liste_titre"><td><b>'.$langs->trans("Contact").'</b></td>'; 343 print '<td><b>Poste</b></td><td><b>'.$langs->trans("Tel").'</b></td>'; 344 print "<td><b>".$langs->trans("Fax")."</b></td><td><b>".$langs->trans("EMail")."</b></td>"; 345 346 if ($user->rights->societe->contact->creer) 347 { 348 print "<td align=\"center\"><a href=\"".DOL_URL_ROOT.'/contact/fiche.php?socid='.$socid."&action=create\">".$langs->trans("AddContact")."</a></td>"; 349 } 350 351 print "</tr>"; 352 353 $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note"; 354 $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p"; 355 $sql.= " WHERE p.fk_soc = ".$societe->id; 356 $sql.= " ORDER by p.datec"; 357 358 $result = $db->query($sql); 359 360 $i = 0 ; 361 $num = $db->num_rows($result); 362 $var=true; 363 364 while ($i < $num) 365 { 366 $obj = $db->fetch_object($result); 367 $var = !$var; 368 369 print "<tr $bc[$var]>"; 370 371 print '<td>'; 372 print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->idp.'">'; 373 print img_object($langs->trans("ShowContact"),"contact"); 374 print ' '.$obj->firstname.' '. $obj->name.'</a> '; 375 376 if ($obj->note) 377 { 378 print "<br>".nl2br($obj->note); 379 } 380 print "</td>"; 381 print "<td>$obj->poste </td>"; 382 print '<td><a href="../comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->phone.'</a> </td>'; 383 print '<td><a href="../comm/action/fiche.php?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->fax.'</a> </td>'; 384 print '<td><a href="../comm/action/fiche.php?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->email.'</a> </td>'; 385 386 if ($user->rights->societe->contact->creer) 387 { 388 print "<td align=\"center\"><a href=\"../contact/fiche.php?action=edit&id=$obj->idp\">".img_edit()."</a></td>"; 389 } 390 391 print "</tr>\n"; 392 $i++; 393 } 394 print "</table>"; 395 396 } 397 else 398 { 399 dolibarr_print_error($db); 400 } 401 $db->close(); 402 403 llxFooter("<em>Dernière modification $Date: 2005/12/05 20:52:43 $ révision $Revision: 1.53 $</em>"); 404 ?>
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 |
![]() |