diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 71ebd674712..f73d7795c08 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -92,6 +92,10 @@ if ($mode == 'search') { $db->free(); } } +/* + * + */ +$socid = $_GET["socid"]; /* * Sécurité si un client essaye d'accéder à une autre fiche que la sienne */ @@ -99,13 +103,14 @@ if ($user->societe_id > 0) { $socid = $user->societe_id; } -/* +/********************************************************************************* * * Mode fiche * * - */ -if ($socid > 0) { + *********************************************************************************/ +if ($socid > 0) +{ $societe = new Societe($db, $socid); @@ -198,33 +203,73 @@ if ($socid > 0) { * Propales * */ - - print ''; + $var = true; + print '
'; $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; $sql .= " FROM llx_societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; $sql .= " AND s.idp = $objsoc->idp ORDER BY p.datep DESC"; - if ( $db->query($sql) ) { - $num = $db->num_rows(); - if ($num >0 ) { - print ""; + if ( $db->query($sql) ) + { + $num = $db->num_rows(); + if ($num >0 ) + { + print ""; + $var=!$var; + } + $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; + while ($i < $num && $i < 2) + { + $objp = $db->fetch_object( $i); + print ""; + print "\n"; + print "\n"; + print "\n"; + $var=!$var; + $i++; + } + $db->free(); } - $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; - while ($i < $num && $i < 4) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - $db->free(); - } + /* + * Commandes + * + */ + print '
idp\">Liste des propales ($num)
idp\">Liste des propales ($num)
propalid\">$objp->ref\n"; + if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) + { + print " > 15 jours"; + } + print "".strftime("%d %B %Y",$objp->dp)."".price($objp->price)."$objp->statut
propalid\">$objp->ref\n"; - if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) { - print " > 15 jours"; - } - print "".strftime("%d %B %Y",$objp->dp)."".price($objp->price)."$objp->statut
'; + $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.ref, ".$db->pdate("p.date_commande")." as dp"; + $sql .= " FROM llx_societe as s, llx_commande as p WHERE p.fk_soc = s.idp "; + $sql .= " AND s.idp = $objsoc->idp ORDER BY p.date_commande DESC"; + + if ( $db->query($sql) ) + { + $num = $db->num_rows(); + if ($num >0 ) + { + print ""; + print ''; + } + $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; + while ($i < $num && $i < 2) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print '\n"; + print "\n"; + print "\n"; + $i++; + } + $db->free(); + } /* *
Liste des commandes ('.$num.')
'.$objp->ref."\n"; + if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) + { + print " > 15 jours"; + } + print "".strftime("%d %B %Y",$objp->dp)."".price($objp->price)."$objp->statut