From b695a2e5bbbd50948a6f31f6dc8301865ef2a377 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 12 Feb 2004 18:14:58 +0000 Subject: [PATCH] Nouveau design --- htdocs/fourn/fiche.php | 437 ++++++++++++----------------------------- 1 file changed, 123 insertions(+), 314 deletions(-) diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index deef7f1f975..41917239353 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -24,7 +24,7 @@ require("./pre.inc.php"); require("../contact.class.php"); llxHeader(); - +$socid = $_GET["socid"]; /* * Sécurité accés client */ @@ -33,338 +33,147 @@ if ($user->societe_id > 0) $action = ''; $socid = $user->societe_id; } - -if ($sortorder == "") -{ - $sortorder="ASC"; -} -if ($sortfield == "") -{ - $sortfield="nom"; -} - -if ($action == 'attribute_prefix') -{ - $societe = new Societe($db, $socid); - $societe->attribute_prefix($db, $socid); -} - -if ($action == 'recontact') -{ - $dr = mktime(0, 0, 0, $remonth, $reday, $reyear); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')"; - $result = $db->query($sql); -} - -if ($action == 'note') { - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET note='$note' WHERE idp=$socid"; - $result = $db->query($sql); -} - -if ($action == 'stcomm') { - if ($stcommid <> 'null' && $stcommid <> $oldstcomm) { - $sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) "; - $sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $GLOBALS["REMOTE_USER"] . "')"; - $result = @$db->query($sql); - - if ($result) { - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=$socid"; - $result = $db->query($sql); - } else { - $errmesg = "ERREUR DE DATE !"; - } - } - - if ($actioncommid) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')"; - $result = @$db->query($sql); - - if (!$result) - { - $errmesg = "ERREUR DE DATE !"; - } - } -} - -/** - * 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(); - } -} /* * * Mode fiche * * */ -if ($socid > 0) -{ - $societe = new Societe($db, $socid); - - $sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc, s.tel, s.fax, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."c_typent as t, ".MAIN_DB_PREFIX."c_effectif as e "; - $sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id"; +$societe = new Societe($db); - if ($to == 'next') +if ( $societe->fetch($socid) ) +{ + $head[0][0] = 'soc.php?socid='.$societe->id; + $head[0][1] = "Fiche société"; + $h = 1; + + $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; + $head[$h][1] = 'Fiche Fournisseur'; + $a = $h; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/product/liste.php?type=0&fourn_id='.$societe->id; + $head[$h][1] = 'Produits'; + $h++; + + dolibarr_fiche_head($head, $a); + + print_titre("Fiche fournisseur : $societe->nom"); + + /* + * + * + */ + print ''; + print ''; + print '
'; + /* + * + */ + print ''; + print ''; + print ''; + + print '
Tél'.$societe->tel.' fax'.$societe->fax.' 
Adresse'.nl2br($societe->address).'
'.$societe->cp.' '.$societe->ville.'
'; + /* + * + */ + print '
'; + /* + * + * Liste des factures associées + * + */ + $sql = "SELECT p.rowid,p.libelle,p.facnumber,".$db->pdate("p.datef")." as df"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as p WHERE p.fk_soc = $societe->id"; + $sql .= " ORDER BY p.datef DESC LIMIT 0,4"; + if ( $db->query($sql) ) { - $sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1"; - } - elseif ($to == 'prev') - { - $sql .= " AND s.idp < $socid ORDER BY idp DESC LIMIT 1"; + print ''; + $i = 0 ; + $num = $db->num_rows(); + if ($num > 0) + { + print ''; + print ""; + } + while ($i < $num && $i < 5) + { + $obj = $db->fetch_object( $i); + $tag = !$tag; + print ""; + print ''; + print ""; + $i++; + } + $db->free(); + print "
id\">liste des factures
'; + print ''; + print img_file(); + print $obj->facnumber.' '.$obj->libelle.'".strftime("%d %b %Y", $obj->df) ."
"; } else { - $sql .= " AND s.idp = $socid"; + print $db->error(); } - + + /* + * + * + */ + print '
' . "
\n"; + + + /* + * + * Liste des contacts + * + */ + print ''; + + print ""; + print ''; + print ""; + print ""; + + $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note"; + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p WHERE p.fk_soc = $societe->id ORDER by p.datec"; $result = $db->query($sql); - - if ($result) + $i = 0 ; $num = $db->num_rows(); $tag = True; + while ($i < $num) { - $objsoc = $db->fetch_object(0); - - $dac = strftime("%Y-%m-%d %H:%M", time()); - if ($errmesg) { - print "$errmesg
"; - } - - /* - * - */ - print '
Prénom NomPosteTélFaxEmailid&action=addcontact\">Ajouter
'; - - print ""; - - print ''; - - print ""; - print ''; - - print "
Fiche fournisseur : $objsoc->nom
Nouvelle Facture Nouvelle facture[idp&action=edit\">Editer]Produits
"; - /* - * - * - */ - print ''; - print ''; - print '
'; - /* - * - */ - print ''; - print ''; - print ''; - - print '
Tél'.$objsoc->tel.' fax'.$objsoc->fax.' 
Adresse'.nl2br($objsoc->address).'
'.$objsoc->cp.' '.$objsoc->ville.'
'; - /* - * - */ - print '
'; - /* - * - * Liste des factures associées - * - */ - $sql = "SELECT p.rowid,p.libelle,p.facnumber,".$db->pdate("p.datef")." as df"; - $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as p WHERE p.fk_soc = $objsoc->idp"; - $sql .= " ORDER BY p.datef DESC LIMIT 0,4"; - if ( $db->query($sql) ) - { - print ''; - $i = 0 ; - $num = $db->num_rows(); - if ($num > 0) - { - print ''; - print ""; - } - while ($i < $num && $i < 5) - { - $obj = $db->fetch_object( $i); - $tag = !$tag; - print ""; - print ''; - print ""; - $i++; - } - $db->free(); - print "
idp\">liste des factures
'; - print ''; - print img_file(); - print $obj->facnumber.' '.$obj->libelle.'".strftime("%d %b %Y", $obj->df) ."
"; - } - else - { - print $db->error(); - } - - /* - * - * - */ - print '
' . "
\n"; - - - /* - * - * Liste des contacts - * - */ - print ''; - - print ""; - print ''; - print ""; - print ""; - - $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note"; - $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p WHERE p.fk_soc = $objsoc->idp ORDER by p.datec"; - $result = $db->query($sql); - $i = 0 ; $num = $db->num_rows(); $tag = True; - while ($i < $num) + $obj = $db->fetch_object( $i); + if ($tag) { - $obj = $db->fetch_object( $i); - if ($tag) - { - print ""; - } - else - { - print ""; - } - print ""; - print ""; - print ''; - print ''; - print ''; - print ""; - print "\n"; - $i++; - $tag = !$tag; + print ""; } - print "
Prénom NomPosteTélFaxEmailidp&action=addcontact\">Ajouter
$obj->firstname $obj->name"; - if ($obj->note) - { - print "
".nl2br($obj->note); - } - print "
$obj->poste '.$obj->phone.' '.$obj->fax.' '.$obj->email.' idp&action=editcontact&contactid=$obj->idp\">Modifier
"; - - - /* - * - */ - print ''; - print ''; - print '"; } - print "
'; - /* - * - * Listes des actions - * - */ - $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; - $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; - $sql .= " WHERE a.fk_soc = $objsoc->idp "; - $sql .= " AND u.rowid = a.fk_user_author"; - $sql .= " AND c.id=a.fk_action "; - $sql .= " ORDER BY a.datea DESC, a.id DESC"; - - if ( $db->query($sql) ) + else { - print "\n"; - print ''; - - $i = 0 ; $num = $db->num_rows(); $tag = True; - while ($i < $num) - { - $obj = $db->fetch_object( $i); - if ($tag) - { - print ""; - } - else - { - print ""; - } - - if ($oldyear == strftime("%Y",$obj->da) ) - { - print ''; - } - else - { - print "\n"; - $oldyear = strftime("%Y",$obj->da); - } - - if ($oldmonth == strftime("%Y%b",$obj->da) ) { - print ''; - } else { - print "\n"; - $oldmonth = strftime("%Y%b",$obj->da); - } - - print "\n"; - print "\n"; - - if ($obj->propalrowid) { - print ''; - } else { - print ''; - } - /* - * Contact pour cette action - * - */ - if ($obj->fk_contact) { - $contact = new Contact($db); - $contact->fetch($obj->fk_contact); - print ''; - } else { - print ''; - } - /* - */ - print ''; - print "\n"; - $i++; - $tag = !$tag; - } - print "
Actions
|" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)."'.$obj->libelle.''.$obj->libelle.''.$contact->fullname.' '.$obj->code.'
"; - - $db->free(); - } else { - print $db->error() . "
" . $sql; + print "
"; - /* - * - * Notes sur la societe - * - */ - print ''; - print ""; - print "
".nl2br($objsoc->note)."
"; + print "$obj->firstname $obj->name"; + if ($obj->note) + { + print "
".nl2br($obj->note); + } + print ""; + print "$obj->poste "; + print ''.$obj->phone.' '; + print ''.$obj->fax.' '; + print ''.$obj->email.' '; + print "id&action=editcontact&contactid=$obj->idp\">Modifier"; + print "\n"; + $i++; + $tag = !$tag; + } + print ""; + /* + * + */ + print '
'; + print 'Nouvelle Facture'; + print '
'; - } - else { - print $db->error() . "
" . $sql; - } } else {