[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> 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.111 2005/11/15 22:57:57 eldy Exp $ 21 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/comm/fiche.php,v $ 22 */ 23 24 /** 25 \file htdocs/comm/fiche.php 26 \ingroup commercial 27 \brief Onglet client de la fiche societe 28 \version $Revision: 1.111 $ 29 */ 30 31 require_once ("./pre.inc.php"); 32 33 if (!$user->rights->societe->lire) accessforbidden(); 34 35 require_once (DOL_DOCUMENT_ROOT."/contact.class.php"); 36 require_once (DOL_DOCUMENT_ROOT."/propal.class.php"); 37 require_once (DOL_DOCUMENT_ROOT."/actioncomm.class.php"); 38 require_once (DOL_DOCUMENT_ROOT."/commande/commande.class.php"); 39 require_once (DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); 40 41 $langs->load("companies"); 42 $langs->load("orders"); 43 $langs->load("contracts"); 44 if ($conf->fichinter->enabled) $langs->load("interventions"); 45 46 llxHeader('',$langs->trans('CustomerCard')); 47 48 $sortorder=$_GET["sortorder"]; 49 $sortfield=$_GET["sortfield"]; 50 51 if (! $sortorder) $sortorder="ASC"; 52 if (! $sortfield) $sortfield="nom"; 53 54 55 if ($_GET["action"] == 'attribute_prefix') 56 { 57 $societe = new Societe($db, $_GET["socid"]); 58 $societe->attribute_prefix($db, $_GET["socid"]); 59 } 60 61 if ($action == 'recontact') 62 { 63 $dr = mktime(0, 0, 0, $remonth, $reday, $reyear); 64 $sql = "INSERT INTO ".MAIN_DB_PREFIX."soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $user->login ."')"; 65 $result = $db->query($sql); 66 } 67 68 if ($action == 'stcomm') 69 { 70 if ($stcommid <> 'null' && $stcommid <> $oldstcomm) 71 { 72 $sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) "; 73 $sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $user->login . "')"; 74 $result = @$db->query($sql); 75 76 if ($result) 77 { 78 $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=$socid"; 79 $result = $db->query($sql); 80 } 81 else 82 { 83 $errmesg = "ERREUR DE DATE !"; 84 } 85 } 86 87 if ($actioncommid) 88 { 89 $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')"; 90 $result = @$db->query($sql); 91 92 if (!$result) 93 { 94 $errmesg = "ERREUR DE DATE !"; 95 } 96 } 97 } 98 99 /* 100 * Recherche 101 * 102 */ 103 if ($mode == 'search') { 104 if ($mode-search == 'soc') { 105 $sql = "SELECT s.idp FROM ".MAIN_DB_PREFIX."societe as s "; 106 $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; 107 } 108 109 if ( $db->query($sql) ) { 110 if ( $db->num_rows() == 1) { 111 $obj = $db->fetch_object(); 112 $socid = $obj->idp; 113 } 114 $db->free(); 115 } 116 } 117 118 // Protection quand utilisateur externe 119 $_socid = isset($_GET["socid"])?$_GET["socid"]:''; 120 if ($user->societe_id > 0) 121 { 122 $_socid = $user->societe_id; 123 } 124 125 126 /********************************************************************************* 127 * 128 * Mode fiche 129 * 130 *********************************************************************************/ 131 if ($_socid > 0) 132 { 133 // On recupere les donnees societes par l'objet 134 $objsoc = new Societe($db); 135 $objsoc->id=$_socid; 136 $objsoc->fetch($_socid,$to); 137 138 $dac = strftime("%Y-%m-%d %H:%M", time()); 139 if ($errmesg) 140 { 141 print "<b>$errmesg</b><br>"; 142 } 143 144 /* 145 * Affichage onglets 146 */ 147 $h = 0; 148 149 $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; 150 $head[$h][1] = $langs->trans("Company"); 151 $h++; 152 153 if ($objsoc->client==1) 154 { 155 $hselected=$h; 156 $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id; 157 $head[$h][1] = $langs->trans("Customer");; 158 $h++; 159 } 160 if ($objsoc->client==2) 161 { 162 $hselected=$h; 163 $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->socid; 164 $head[$h][1] = $langs->trans("Prospect"); 165 $h++; 166 } 167 if ($objsoc->fournisseur) 168 { 169 $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id; 170 $head[$h][1] = $langs->trans("Supplier"); 171 $h++; 172 } 173 174 if ($conf->compta->enabled) { 175 $langs->load("compta"); 176 $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; 177 $head[$h][1] = $langs->trans("Accountancy"); 178 $h++; 179 } 180 181 $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; 182 $head[$h][1] = $langs->trans("Note"); 183 $h++; 184 185 if ($user->societe_id == 0) 186 { 187 $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id; 188 $head[$h][1] = $langs->trans("Documents"); 189 $h++; 190 } 191 192 $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; 193 $head[$h][1] = $langs->trans("Notifications"); 194 $h++; 195 196 $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id; 197 $head[$h][1] = $langs->trans("Info"); 198 $h++; 199 200 if ($user->societe_id == 0) 201 { 202 $head[$h][0] = DOL_URL_ROOT."/bookmarks/fiche.php?action=add&socid=".$objsoc->id."&urlsource=".$_SERVER["PHP_SELF"]."?socid=".$objsoc->id; 203 $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); 204 $head[$h][2] = 'image'; 205 $h++; 206 } 207 208 dolibarr_fiche_head($head, $hselected, $objsoc->nom); 209 210 211 /* 212 * 213 * 214 */ 215 print '<table width="100%" border="0">'; 216 print '<tr><td valign="top">'; 217 print '<table class="border" width="100%">'; 218 219 print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'; 220 print $objsoc->nom; 221 print '</td></tr>'; 222 223 print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$objsoc->prefix_comm.'</td></tr>'; 224 225 if ($objsoc->client) 226 { 227 print '<tr><td>'; 228 print $langs->trans('CustomerCode').'</td><td colspan="3">'; 229 print $objsoc->code_client; 230 if ($objsoc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); 231 print '</td></tr>'; 232 } 233 if ($conf->compta->enabled) 234 { 235 print '<tr>'; 236 print '<td nowrap>'.$langs->trans("CustomerAccountancyCode").'</td><td colspan="3">'.$objsoc->code_compta.'</td>'; 237 print '</tr>'; 238 } 239 240 /* 241 if ($objsoc->fournisseur) { 242 print '<tr><td>'; 243 print $langs->trans('SupplierCode').'</td><td colspan="3">'; 244 print $objsoc->code_fournisseur; 245 if ($objsoc->check_codefournisseur() <> 0) print ' '.$langs->trans("WrongSupplierCode"); 246 print '</td></tr>'; 247 } 248 */ 249 250 print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($objsoc->adresse)."</td></tr>"; 251 252 print '<tr><td>'.$langs->trans('Zip').'</td><td>'.$objsoc->cp."</td>"; 253 print '<td>'.$langs->trans('Town').'</td><td>'.$objsoc->ville."</td></tr>"; 254 if ($objsoc->pays) { 255 print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$objsoc->pays.'</td></tr>'; 256 } 257 258 print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dolibarr_print_phone($objsoc->tel,$objsoc->pays_code).'</td>'; 259 print '<td>'.$langs->trans('Fax').'</td><td>'.dolibarr_print_phone($objsoc->fax,$objsoc->pays_code).'</td></tr>'; 260 261 print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$objsoc->url\" target=\"_blank\">".$objsoc->url."</a> </td></tr>"; 262 if ($objsoc->siren || $objsoc->siret) { 263 print "<tr><td nowrap>".$langs->transcountry("ProfId1",$objsoc->pays_code)."</td><td><a href=\"http://www.societe.com/cgi-bin/recherche?rncs=".$objsoc->siren."\" target=\"_blank\">".$objsoc->siren."</a> </td>"; 264 print '<td>'.$langs->transcountry('ProfId2',$objsoc->pays_code).'</td><td>'.$objsoc->siret.'</td></tr>'; 265 } 266 if ($objsoc->ape) { 267 print '<tr><td>'.$langs->transcountry('ProfId3',$objsoc->pays_code).'</td><td>'.$objsoc->ape.'</td><td colspan="2"> </td></tr>'; 268 } 269 270 // Type + Staff 271 $arr = $objsoc->typent_array($objsoc->typent_id); 272 $objsoc->typent= $arr[$objsoc->typent_id]; 273 if ($objsoc->typent || $objsoc->effectif) { 274 print '<tr><td>'.$langs->trans("Type").'</td><td>'.$objsoc->typent.'</td><td>'.$langs->trans("Staff").'</td><td nowrap>'.$objsoc->effectif.'</td></tr>'; 275 } 276 277 // Remise permanente 278 print '<tr><td nowrap>'; 279 print '<table width="100%" class="nobordernopadding"><tr><td nowrap>'; 280 print $langs->trans("CustomerRelativeDiscount"); 281 print '<td><td align="right">'; 282 print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$objsoc->id.'">'.img_edit($langs->trans("Modify")).'</a>'; 283 print '</td></tr></table>'; 284 print '</td><td colspan="3">'.$objsoc->remise_client." %</td>"; 285 print '</tr>'; 286 287 // Remise avoirs 288 print '<tr><td nowrap>'; 289 print '<table width="100%" class="nobordernopadding">'; 290 print '<tr><td nowrap>'; 291 print $langs->trans("CustomerAbsoluteDiscount"); 292 print '<td><td align="right">'; 293 print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$objsoc->id.'">'.img_edit($langs->trans("Modify")).'</a>'; 294 print '</td></tr></table>'; 295 print '</td>'; 296 print '<td colspan="3">'; 297 $sql = "SELECT rc.amount_ht,".$db->pdate("rc.datec")." as dc"; 298 $sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc"; 299 $sql .= " WHERE rc.fk_soc =". $objsoc->id; 300 $sql .= " AND rc.fk_user = ".$user->id." AND fk_facture IS NULL"; 301 $resql=$db->query($sql); 302 if ($resql) 303 { 304 $obj = $db->fetch_object($resql); 305 if ($obj->amount_ht) print $obj->amount_ht.' '.$langs->trans("Currency".$conf->monnaie); 306 else print $langs->trans("None"); 307 } 308 print '</td>'; 309 print '</tr>'; 310 311 312 print "</table>"; 313 314 print "</td>\n"; 315 316 317 print '<td valign="top" width="50%">'; 318 319 // Nbre max d'éléments des petites listes 320 $MAXLIST=4; 321 322 323 /* 324 * Dernieres propales 325 */ 326 if ($conf->propal->enabled) 327 { 328 $propal_static=new Propal($db); 329 330 print '<table class="noborder" width="100%">'; 331 332 $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.fk_statut, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; 333 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; 334 $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; 335 $sql .= " AND s.idp = ".$objsoc->id; 336 $sql .= " ORDER BY p.datep DESC"; 337 338 $resql=$db->query($sql); 339 if ($resql) 340 { 341 $var=true; 342 $num = $db->num_rows($resql); 343 if ($num > 0) 344 { 345 print '<tr class="liste_titre">'; 346 print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/comm/propal.php?socidp='.$objsoc->id.'">'.$langs->trans("AllPropals").' ('.$num.')</td></tr></table></td>'; 347 print '</tr>'; 348 $var=!$var; 349 } 350 $i = 0; 351 while ($i < $num && $i < $MAXLIST) 352 { 353 $objp = $db->fetch_object($resql); 354 print "<tr $bc[$var]>"; 355 print "<td nowrap><a href=\"propal.php?propalid=$objp->propalid\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."</a>\n"; 356 if ( ($objp->dp < time() - $conf->propal->cloture->warning_delay) && $objp->statutid == 1 ) 357 { 358 print " ".img_warning(); 359 } 360 print '</td><td align="right" width="80">'.dolibarr_print_date($objp->dp)."</td>\n"; 361 print '<td align="right" width="120">'.price($objp->price).'</td>'; 362 print '<td align="center" width="100">'.$propal_static->labelstatut_short[$objp->fk_statut].'</td></tr>'; 363 $var=!$var; 364 $i++; 365 } 366 $db->free($resql); 367 } 368 else { 369 dolibarr_print_error($db); 370 } 371 print "</table>"; 372 } 373 374 /* 375 * Dernieres commandes 376 */ 377 if($conf->commande->enabled) 378 { 379 $commande_static=new Commande($db); 380 381 print '<table class="noborder" width="100%">'; 382 383 $sql = "SELECT s.nom, s.idp, c.rowid as cid, c.total_ht, c.ref, c.fk_statut, ".$db->pdate("c.date_commande")." as dc"; 384 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; 385 $sql .= " WHERE c.fk_soc = s.idp "; 386 $sql .= " AND s.idp = $objsoc->id"; 387 $sql .= " ORDER BY c.date_commande DESC"; 388 389 $resql=$db->query($sql); 390 if ($resql) 391 { 392 $var=true; 393 $num = $db->num_rows($resql); 394 if ($num >0 ) 395 { 396 print '<tr class="liste_titre">'; 397 print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/commande/liste.php?socidp='.$objsoc->id.'">'.$langs->trans("AllOrders").' ('.$num.')</a></td></tr></table></td>'; 398 print '</tr>'; 399 } 400 $i = 0; 401 while ($i < $num && $i < $MAXLIST) 402 { 403 $objp = $db->fetch_object($resql); 404 $var=!$var; 405 print "<tr $bc[$var]>"; 406 print '<td><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$objp->cid.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$objp->ref."</a>\n"; 407 print '</td><td align="right" width="80">'.dolibarr_print_date($objp->dc)."</td>\n"; 408 print '<td align="right" width="120">'.price($objp->total_ht).'</td>'; 409 print '<td align="center" width="100">'.$commande_static->status_label_short[$objp->fk_statut].'</td></tr>'; 410 $i++; 411 } 412 $db->free($resql); 413 } 414 else { 415 dolibarr_print_error($db); 416 } 417 print "</table>"; 418 } 419 420 /* 421 * Derniers contrats 422 */ 423 if($conf->contrat->enabled) 424 { 425 $contratstatic=new Contrat($db); 426 427 print '<table class="noborder" width="100%">'; 428 429 $sql = "SELECT s.nom, s.idp, c.rowid as id, c.ref as ref, c.statut, ".$db->pdate("c.datec")." as dc"; 430 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; 431 $sql .= " WHERE c.fk_soc = s.idp "; 432 $sql .= " AND s.idp = $objsoc->id"; 433 $sql .= " ORDER BY c.datec DESC"; 434 435 $resql=$db->query($sql); 436 if ($resql) 437 { 438 $var=true; 439 $num = $db->num_rows($resql); 440 if ($num >0 ) 441 { 442 print '<tr class="liste_titre">'; 443 print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).'</td>'; 444 print '<td align="right"><a href="'.DOL_URL_ROOT.'/contrat/liste.php?socid='.$objsoc->id.'">'.$langs->trans("AllContracts").' ('.$num.')</td></tr></table></td>'; 445 print '</tr>'; 446 } 447 $i = 0; 448 while ($i < $num && $i < $MAXLIST) 449 { 450 $objp = $db->fetch_object($resql); 451 $var=!$var; 452 print "<tr $bc[$var]>"; 453 print '<td><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$objp->id.'">'.img_object($langs->trans("ShowContract"),"contract").' ' 454 .(!isset($objp->ref) ? $objp->id : $objp->ref) ."</a></td>\n"; 455 print '<td align="right" width="80">'.dolibarr_print_date($objp->dc)."</td>\n"; 456 print '<td width="20"> </td>'; 457 print '<td align="center" width="100">'.$contratstatic->LibStatut($objp->statut)."</td>\n"; 458 print '</tr>'; 459 $i++; 460 } 461 $db->free($resql); 462 } 463 else { 464 dolibarr_print_error($db); 465 } 466 print "</table>"; 467 } 468 469 /* 470 * Dernieres interventions 471 */ 472 if ($conf->fichinter->enabled) 473 { 474 print '<table class="noborder" width="100%">'; 475 476 $sql = "SELECT s.nom, s.idp, f.rowid as id, f.ref, ".$db->pdate("f.datei")." as di"; 477 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f"; 478 $sql .= " WHERE f.fk_soc = s.idp"; 479 $sql .= " AND s.idp = ".$objsoc->id; 480 $sql .= " ORDER BY f.datei DESC"; 481 482 $resql=$db->query($sql); 483 if ($resql) 484 { 485 $var=true; 486 $num = $db->num_rows($resql); 487 if ($num >0 ) 488 { 489 print '<tr class="liste_titre">'; 490 print '<td colspan="4"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/fichinter/index.php?socidp='.$objsoc->id.'">'.$langs->trans("AllInterventions").' ('.$num.')</td></tr></table></td>'; 491 print '</tr>'; 492 $var=!$var; 493 } 494 $i = 0; 495 while ($i < $num && $i < $MAXLIST) 496 { 497 $objp = $db->fetch_object($resql); 498 print "<tr $bc[$var]>"; 499 print '<td nowrap><a href="'.DOL_URL_ROOT."/fichinter/fiche.php?id=".$objp->id."\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."</a>\n"; 500 print "</td><td align=\"right\">".dolibarr_print_date($objp->di)."</td>\n"; 501 print '</tr>'; 502 $var=!$var; 503 $i++; 504 } 505 $db->free($resql); 506 } 507 else { 508 dolibarr_print_error($db); 509 } 510 print "</table>"; 511 } 512 513 /* 514 * Derniers projets associés 515 */ 516 if ($conf->projet->enabled) 517 { 518 print '<table class="noborder" width=100%>'; 519 520 $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; 521 $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; 522 $sql .= " WHERE p.fk_soc = $objsoc->id"; 523 $sql .= " ORDER BY p.dateo DESC"; 524 525 $result=$db->query($sql); 526 if ($result) { 527 $var=true; 528 $i = 0 ; 529 $num = $db->num_rows($result); 530 if ($num > 0) { 531 print '<tr class="liste_titre">'; 532 print '<td colspan="2"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/projet/liste.php?socid='.$objsoc->id.'">'.$langs->trans("AllProjects").' ('.$num.')</td></tr></table></td>'; 533 print '</tr>'; 534 } 535 while ($i < $num && $i < $MAXLIST) { 536 $obj = $db->fetch_object($result); 537 $var = !$var; 538 print "<tr $bc[$var]>"; 539 print '<td><a href="../projet/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowProject"),"project")." ".$obj->title.'</a></td>'; 540 541 print "<td align=\"right\">".$obj->ref ."</td></tr>"; 542 $i++; 543 } 544 $db->free($result); 545 } 546 else 547 { 548 dolibarr_print_error($db); 549 } 550 print "</table>"; 551 } 552 553 print "</td></tr>"; 554 print "</table></div>\n"; 555 556 557 /* 558 * Barre d'action 559 * 560 */ 561 print '<div class="tabsAction">'; 562 563 if ($conf->propal->enabled && $user->rights->propale->creer) 564 { 565 $langs->load("propal"); 566 print '<a class="butAction" href="addpropal.php?socidp='.$objsoc->id.'&action=create">'.$langs->trans("AddProp").'</a>'; 567 } 568 569 if ($conf->commande->enabled && $user->rights->commande->creer) 570 { 571 $langs->load("orders"); 572 print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/fiche.php?socidp='.$objsoc->id.'&action=create">'.$langs->trans("AddOrder").'</a>'; 573 } 574 575 if ($user->rights->contrat->creer) 576 { 577 $langs->load("contracts"); 578 print '<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/fiche.php?socid='.$objsoc->id.'&action=create">'.$langs->trans("AddContract").'</a>'; 579 } 580 581 if ($conf->fichinter->enabled) 582 { 583 $langs->load("fichinter"); 584 print '<a class="butAction" href="../fichinter/fiche.php?socidp='.$objsoc->id.'&action=create">'.$langs->trans("AddIntervention").'</a>'; 585 } 586 587 print '<a class="butAction" href="action/fiche.php?action=create&socid='.$objsoc->id.'">'.$langs->trans("AddAction").'</a>'; 588 589 print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$objsoc->id.'&action=create">'.$langs->trans("AddContact").'</a>'; 590 591 print '</div>'; 592 print '<br>'; 593 594 if ($action == 'changevalue') 595 { 596 print "<hr noshade>"; 597 print "<form action=\"index.php?socid=$objsoc->id\" method=\"post\">"; 598 print "<input type=\"hidden\" name=\"action\" value=\"cabrecrut\">"; 599 print "Cette société est un cabinet de recrutement : "; 600 print "<select name=\"selectvalue\">"; 601 print "<option value=\"\">"; 602 print "<option value=\"t\">Oui"; 603 print "<option value=\"f\">Non"; 604 print "</select>"; 605 print "<input type=\"submit\" value=\"".$langs->trans("Valid")."\">"; 606 print "</form>\n"; 607 } 608 else 609 { 610 /* 611 * 612 * Liste des contacts 613 * 614 */ 615 if ($conf->clicktodial->enabled) 616 { 617 $user->fetch_clicktodial(); // lecture des infos de clicktodial 618 } 619 620 print '<table class="noborder" width="100%">'; 621 622 print '<tr class="liste_titre"><td>'.$langs->trans("Firstname").' '.$langs->trans("Lastname").'</td>'; 623 print '<td>'.$langs->trans("Poste").'</td><td colspan="2">'.$langs->trans("Tel").'</td>'; 624 print '<td>'.$langs->trans("Fax").'</td><td>'.$langs->trans("EMail").'</td>'; 625 print "<td> </td>"; 626 print '<td> </td>'; 627 print "</tr>"; 628 629 $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note "; 630 $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; 631 $sql .= " WHERE p.fk_soc = $objsoc->id"; 632 $sql .= " ORDER by p.datec"; 633 634 $result = $db->query($sql); 635 $i = 0; 636 $num = $db->num_rows($result); 637 $var=true; 638 639 while ($i < $num) 640 { 641 $obj = $db->fetch_object($result); 642 $var = !$var; 643 print "<tr $bc[$var]>"; 644 645 print '<td>'; 646 print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->idp.'">'; 647 print img_object($langs->trans("Show"),"contact"); 648 print ' '.$obj->firstname.' '. $obj->name.'</a> '; 649 650 if (trim($obj->note)) 651 { 652 print '<br>'.nl2br(trim($obj->note)); 653 } 654 print '</td>'; 655 print '<td>'.$obj->poste.' </td>'; 656 print '<td>'; 657 658 // Lien click to dial 659 if (strlen($obj->phone) && $user->clicktodial_enabled == 1) 660 { 661 print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$objsoc->id.'&call='.$obj->phone.'">'; 662 print img_phone_out("Appel émis") ; 663 } 664 print '</td><td>'; 665 print '<a href="action/fiche.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$objsoc->id.'">'.dolibarr_print_phone($obj->phone).'</a> </td>'; 666 print '<td><a href="action/fiche.php?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$objsoc->id.'">'.dolibarr_print_phone($obj->fax).'</a> </td>'; 667 print '<td><a href="action/fiche.php?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$objsoc->id.'">'.$obj->email.'</a> </td>'; 668 669 print '<td align="center">'; 670 print "<a href=\"../contact/fiche.php?action=edit&id=$obj->idp\">"; 671 print img_edit(); 672 print '</a></td>'; 673 674 print '<td align="center"><a href="action/fiche.php?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$objsoc->id.'">'; 675 print img_object($langs->trans("Rendez-Vous"),"action"); 676 print '</a></td>'; 677 678 print "</tr>\n"; 679 $i++; 680 } 681 print "</table>"; 682 683 print "<br>"; 684 685 /* 686 * Listes des actions a faire 687 * 688 */ 689 print '<table width="100%" class="noborder">'; 690 print '<tr class="liste_titre"><td colspan="9"><a href="action/index.php?socid='.$objsoc->id.'">'.$langs->trans("ActionsToDo").'</a></td><td align="right"> </td></tr>'; 691 692 $sql = "SELECT a.id, a.label, ".$db->pdate("a.datea")." as da, c.code as acode, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; 693 $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; 694 $sql .= " WHERE a.fk_soc = $objsoc->id "; 695 $sql .= " AND u.rowid = a.fk_user_author"; 696 $sql .= " AND c.id=a.fk_action AND a.percent < 100"; 697 $sql .= " ORDER BY a.datea DESC, a.id DESC"; 698 699 $result=$db->query($sql); 700 if ($result) 701 { 702 $i = 0 ; 703 $num = $db->num_rows($result); 704 $var=true; 705 706 while ($i < $num) 707 { 708 $var = !$var; 709 710 $obj = $db->fetch_object($result); 711 print "<tr $bc[$var]>"; 712 713 if ($oldyear == strftime("%Y",$obj->da) ) 714 { 715 print '<td width="30" align="center">|</td>'; 716 } 717 else 718 { 719 print '<td width="30" align="center">'.strftime("%Y",$obj->da)."</td>\n"; 720 $oldyear = strftime("%Y",$obj->da); 721 } 722 723 if ($oldmonth == strftime("%Y%b",$obj->da) ) 724 { 725 print '<td width="30" align="center">|</td>'; 726 } 727 else 728 { 729 print '<td width="30" align="center">' .strftime("%b",$obj->da)."</td>\n"; 730 $oldmonth = strftime("%Y%b",$obj->da); 731 } 732 733 print '<td width="20">'.strftime("%d",$obj->da)."</td>\n"; 734 print '<td width="30">'.strftime("%H:%M",$obj->da)."</td>\n"; 735 if (date("U",$obj->da) < time()) 736 { 737 print "<td>".img_warning("Late")."</td>"; 738 } 739 740 // Status/Percent 741 print '<td width="30"> </td>'; 742 743 if ($obj->propalrowid) 744 { 745 print '<td><a href="propal.php?propalid='.$obj->propalrowid.'">'.img_object($langs->trans("ShowAction"),"task"); 746 $transcode=$langs->trans("Action".$obj->acode); 747 $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); 748 print $libelle; 749 print '</a></td>'; 750 } 751 else 752 { 753 print '<td><a href="action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowAction"),"task"); 754 $transcode=$langs->trans("Action".$obj->acode); 755 $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); 756 print $libelle; 757 print '</a></td>'; 758 } 759 print "<td>$obj->label</td>"; 760 761 // Contact pour cette action 762 if ($obj->fk_contact) { 763 $contact = new Contact($db); 764 $contact->fetch($obj->fk_contact); 765 print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$contact->id.'">'.img_object($langs->trans("ShowContact"),"contact").' '.$contact->fullname.'</a></td>'; 766 } else { 767 print '<td> </td>'; 768 } 769 770 print '<td width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->fk_user_author.'">'.img_object($langs->trans("ShowUser"),"user").' '.$obj->code.'</a></td>'; 771 print "</tr>\n"; 772 $i++; 773 } 774 print "</table>"; 775 776 $db->free($result); 777 } else { 778 dolibarr_print_error($db); 779 } 780 print "</table><br>"; 781 782 783 /* 784 * Listes des actions effectuees 785 */ 786 print '<table class="noborder" width="100%">'; 787 print '<tr class="liste_titre"><td colspan="10"><a href="action/index.php?socid='.$objsoc->id.'">'.$langs->trans("ActionsDone").'</a></td></tr>'; 788 789 $sql = "SELECT a.id, a.label, ".$db->pdate("a.datea")." as da, c.code as acode, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; 790 $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; 791 $sql .= " WHERE a.fk_soc = $objsoc->id "; 792 $sql .= " AND u.rowid = a.fk_user_author"; 793 $sql .= " AND c.id=a.fk_action AND a.percent = 100"; 794 $sql .= " ORDER BY a.datea DESC, a.id DESC"; 795 796 $result=$db->query($sql); 797 if ($result) 798 { 799 $i = 0 ; 800 $num = $db->num_rows($result); 801 $oldyear=''; 802 $oldmonth=''; 803 $var=true; 804 805 while ($i < $num) 806 { 807 $var = !$var; 808 809 $obj = $db->fetch_object($result); 810 print "<tr $bc[$var]>"; 811 812 // Champ date 813 if ($oldyear == strftime("%Y",$obj->da) ) 814 { 815 print '<td width="30" align="center">|</td>'; 816 } 817 else 818 { 819 print '<td width="30" align="center">'.strftime("%Y",$obj->da)."</td>\n"; 820 $oldyear = strftime("%Y",$obj->da); 821 } 822 823 if ($oldmonth == strftime("%Y%b",$obj->da) ) 824 { 825 print '<td width="30" align="center">|</td>'; 826 } 827 else 828 { 829 print '<td width="30" align="center">'.strftime("%b",$obj->da)."</td>\n"; 830 $oldmonth = strftime("%Y%b",$obj->da); 831 } 832 print '<td width="20">'.strftime("%d",$obj->da)."</td>\n"; 833 print '<td width="30">'.strftime("%H:%M",$obj->da)."</td>\n"; 834 if (date("U",$obj->da) < time()) 835 { 836 print "<td> </td>"; 837 } 838 839 // Statut/Percent 840 print '<td width="30"> </td>'; 841 842 if ($obj->propalrowid) 843 { 844 print '<td><a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$obj->propalrowid.'">'.img_object($langs->trans("ShowAction"),"task"); 845 $transcode=$langs->trans("Action".$obj->acode); 846 $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); 847 print $libelle; 848 print '</a></td>'; 849 } 850 else 851 { 852 print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowAction"),"task"); 853 $transcode=$langs->trans("Action".$obj->acode); 854 $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); 855 print $libelle; 856 print '</a></td>'; 857 } 858 859 print "<td>$obj->label</td>"; 860 // Contact pour cette action 861 if ($obj->fk_contact) 862 { 863 $contact = new Contact($db); 864 $contact->fetch($obj->fk_contact); 865 print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$contact->id.'">'.img_object($langs->trans("ShowContact"),"contact").' '.$contact->fullname.'</a></td>'; 866 } 867 else 868 { 869 print '<td> </td>'; 870 } 871 872 print '<td width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->fk_user_author.'">'.img_object($langs->trans("ShowUser"),"user").' '.$obj->code.'</a></td>'; 873 print "</tr>\n"; 874 $i++; 875 } 876 877 $db->free($result); 878 } 879 else 880 { 881 dolibarr_print_error($db); 882 } 883 print "</table>"; 884 885 } 886 } else { 887 dolibarr_print_error($db); 888 } 889 890 $db->close(); 891 892 893 llxFooter('$Date: 2005/11/15 22:57:57 $ - $Revision: 1.111 $'); 894 ?>
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 |
![]() |