*** empty log message ***

This commit is contained in:
Rodolphe Quiedeville 2002-12-12 16:11:54 +00:00
parent 00b6716cfa
commit 42988dbece
6 changed files with 406 additions and 341 deletions

View File

@ -1,8 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,6 +15,9 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$
* $Source$
*
*/ */
require("./pre.inc.php3"); require("./pre.inc.php3");
@ -45,7 +45,6 @@ print_barre_liste("Liste des contacts",$page, $PHP_SELF);
*/ */
$sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email, p.phone "; $sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email, p.phone ";
$sql .= "FROM societe as s, socpeople as p, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc"; $sql .= "FROM societe as s, socpeople as p, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc";

View File

@ -1,8 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,6 +15,9 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$
* $Source$
*
*/ */
require("./pre.inc.php3"); require("./pre.inc.php3");
@ -25,16 +25,17 @@ llxHeader();
$db = new Db(); $db = new Db();
function valeur($sql)
{
function valeur($sql) {
global $db; global $db;
if ( $db->query($sql) ) { if ( $db->query($sql) )
if ( $db->num_rows() ) { {
$valeur = $db->result(0,0); if ( $db->num_rows() )
{
$valeur = $db->result(0,0);
}
$db->free();
} }
$db->free();
}
return $valeur; return $valeur;
} }
/* /*
@ -113,35 +114,40 @@ if ( $db->query($sql) ) {
print '</table>'; print '</table>';
} }
/* /*
* * Actions commerciales a faire
* *
* *
*/ */
print '</td><td valign="top" width="70%">'; print '</td><td valign="top" width="70%">';
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, a.fk_user_author, a.fk_contact"; $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, a.fk_user_author, a.fk_contact, p.name, s.nom as sname";
$sql .= " FROM actioncomm as a, c_actioncomm as c"; $sql .= " FROM actioncomm as a, c_actioncomm as c, socpeople as p, societe as s";
$sql .= " WHERE c.id=a.fk_action AND a.percent < 100 AND a.fk_user_action = $user->id"; $sql .= " WHERE c.id=a.fk_action AND a.percent < 100 AND a.fk_user_action = $user->id AND a.fk_contact = p.idp AND p.fk_soc = s.idp";
$sql .= " ORDER BY a.datea DESC"; $sql .= " ORDER BY a.datea DESC";
if ( $db->query($sql) ) { if ( $db->query($sql) )
{
print '<TABLE border="0" cellspacing="0" cellpadding="3" width="100%">'; print '<TABLE border="0" cellspacing="0" cellpadding="3" width="100%">';
print "<TR class=\"liste_titre\">"; print '<TR class="liste_titre">';
print "<td colspan=\"2\">Actions à faire</td>"; print '<td colspan="4">Actions à faire</td>';
print "</TR>\n"; print "</TR>\n";
$i = 0; $i = 0;
while ($i < $db->num_rows() ) { while ($i < $db->num_rows() )
$obj = $db->fetch_object($i); {
$var=!$var; $obj = $db->fetch_object($i);
$var=!$var;
print "<tr $bc[$var]><td>".strftime("%d %b %Y",$obj->da)."</td><td><a href=\"action/fiche.php3\">$obj->libelle $obj->label</a></td></tr>"; print "<tr $bc[$var]><td>".strftime("%d %b %Y",$obj->da)."</td>";
$i++; print "<td><a href=\"action/fiche.php3?id=$obj->id\">$obj->libelle $obj->label</a></td><td>$obj->name</td><td>$obj->sname</td></tr>";
} $i++;
}
$db->free(); $db->free();
print "</table><br>"; print "</table><br>";
} else { }
else
{
print $db->error(); print $db->error();
} }

View File

@ -77,50 +77,55 @@ $offset = $limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if ($socid > 0) { if ($socid > 0)
{
$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.cp,s.ville, s.note FROM societe as s, c_stcomm as st "; $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.cp,s.ville, s.note FROM societe as s, c_stcomm as st ";
$sql .= " WHERE s.fk_stcomm=st.id"; $sql .= " WHERE s.fk_stcomm=st.id";
if ($to == 'next') { if ($to == 'next')
$sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1"; {
} else { $sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
$sql .= " AND s.idp = $socid"; }
} else
{
$sql .= " AND s.idp = $socid";
}
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result)
$objsoc = $db->fetch_object( 0); {
$objsoc = $db->fetch_object( 0);
/* /*
* *
* *
*/ */
print "<table width=\"100%\" border=\"0\" cellspacing=\"1\">\n"; print "<table width=\"100%\" border=\"0\" cellspacing=\"1\">\n";
print "<tr><td><a href=\"fiche.php3?socid=$objsoc->idp\">$objsoc->nom</a></td>"; print "<tr><td><a href=\"fiche.php3?socid=$objsoc->idp\">$objsoc->nom</a></td>";
print "<td align=\"center\"><a href=\"socnote.php3?socid=$socid\">Notes</a></big></td>"; print "<td align=\"center\"><a href=\"socnote.php3?socid=$socid\">Notes</a></big></td>";
print "<td bgcolor=\"#e0E0E0\" align=\"center\">[<a href=\"people.php3?socid=$socid&action=addcontact\">Ajouter un contact</a>]</td>"; print "<td align=\"center\">[<a href=\"people.php3?socid=$socid&action=addcontact\">Ajouter un contact</a>]</td>";
print '</td></tr></table>'; print '</td></tr></table>';
/*
*
*/
/* if ($objsoc->note)
* {
*/ print "<table border=0 width=\"100%\" cellspacing=0 bgcolor=#e0e0e0>";
print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
print "</table>";
}
}
print "<table border=0 width=\"100%\" cellspacing=0 bgcolor=#e0e0e0>"; else
print "<tr><td>".nl2br($objsoc->note)."</td></tr>"; {
print "</table>"; print $db->error();
}
$bc1="bgcolor=\"#c0f0c0\"";
$bc3="bgcolor=\"#90c090\"";
$bc2="bgcolor=\"#b0e0b0\"";
} else {
print $db->error();
}
print "<P><table width=\"100%\" cellspacing=0 border=1 cellpadding=2>"; print "<P><table width=\"100%\" cellspacing=0 border=1 cellpadding=2>";
@ -131,75 +136,85 @@ if ($socid > 0) {
$sql = "SELECT p.name, p.firstname, p.poste, p.phone, p.fax, p.email "; $sql = "SELECT p.name, p.firstname, p.poste, p.phone, p.fax, p.email ";
$sql .= " FROM socpeople as p WHERE p.fk_soc = $objsoc->idp"; $sql .= " FROM socpeople as p WHERE p.fk_soc = $objsoc->idp";
if ($contactid) { if ($contactid)
$sql .= " AND p.idp = $contactid"; {
} $sql .= " AND p.idp = $contactid";
}
$sql .= " ORDER by p.datec"; $sql .= " ORDER by p.datec";
$result = $db->query($sql); $result = $db->query($sql);
$i = 0 ; $num = $db->num_rows(); $tag = True; $i = 0 ; $num = $db->num_rows(); $tag = True;
while ($i < $num) { while ($i < $num)
$obj = $db->fetch_object( $i); {
if ($tag) { $obj = $db->fetch_object( $i);
print "<tr bgcolor=\"e0e0e0\">"; if ($tag)
} else { {
print "<tr>"; print "<tr bgcolor=\"e0e0e0\">";
}
else
{
print "<tr>";
}
print "<td>$obj->firstname $obj->name</td>";
print "<td>$obj->poste&nbsp;</td>";
print "<td>$obj->phone&nbsp;</td>";
print "<td>$obj->fax&nbsp;</td>";
print "<td><a href=\"mailto:$obj->email\">$obj->email</a>&nbsp;</td>";
print "</tr>\n";
$i++;
$tag = !$tag;
} }
print "<td>$obj->firstname $obj->name</td>";
print "<td>$obj->poste&nbsp;</td>";
print "<td>$obj->phone&nbsp;</td>";
print "<td>$obj->fax&nbsp;</td>";
print "<td><a href=\"mailto:$obj->email\">$obj->email</a>&nbsp;</td>";
print "</tr>\n";
$i++;
$tag = !$tag;
}
print "</table>"; print "</table>";
if ($action == 'addcontact') { if ($action == 'addcontact')
print "<form method=\"post\" action=\"people.php3?socid=$socid\">"; {
print "<input type=\"hidden\" name=\"action\" value=\"add\">"; print "<form method=\"post\" action=\"people.php3?socid=$socid\">";
print "<table border=0>"; print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print "<tr><td>Nom</td><td><input name=\"name\" type=\"text\" size=\"20\" maxlength=\"80\"></td>"; print "<table border=0>";
print "<td>Prenom</td><td><input name=\"firstname\" type=\"text\" size=\"15\" maxlength=\"80\"></td></tr>"; print "<tr><td>Nom</td><td><input name=\"name\" type=\"text\" size=\"20\" maxlength=\"80\"></td>";
print "<tr><td>Poste</td><td colspan=\"3\"><input name=\"poste\" type=\"text\" size=\"50\" maxlength=\"80\"></td></tr>"; print "<td>Prenom</td><td><input name=\"firstname\" type=\"text\" size=\"15\" maxlength=\"80\"></td></tr>";
print "<tr><td>Tel</td><td><input name=\"phone\" type=\"text\" size=\"18\" maxlength=\"80\"></td>"; print "<tr><td>Poste</td><td colspan=\"3\"><input name=\"poste\" type=\"text\" size=\"50\" maxlength=\"80\"></td></tr>";
print "<td>Fax</td><td><input name=\"fax\" type=\"text\" size=\"18\" maxlength=\"80\"></td></tr>"; print "<tr><td>Tel</td><td><input name=\"phone\" type=\"text\" size=\"18\" maxlength=\"80\"></td>";
print "<tr><td>Email</td><td colspan=\"3\"><input name=\"email\" type=\"text\" size=\"50\" maxlength=\"80\"></td></tr>"; print "<td>Fax</td><td><input name=\"fax\" type=\"text\" size=\"18\" maxlength=\"80\"></td></tr>";
print "</table>"; print "<tr><td>Email</td><td colspan=\"3\"><input name=\"email\" type=\"text\" size=\"50\" maxlength=\"80\"></td></tr>";
print "<input type=\"submit\" value=\"Ajouter\">"; print "</table>";
print "</form>"; print "<input type=\"submit\" value=\"Ajouter\">";
} print "</form>";
}
/* /*
* *
* Edition du contact * Edition du contact
* *
*/ */
if ($action == 'editcontact') { if ($action == 'editcontact')
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note"; {
$sql .= " FROM socpeople as p WHERE p.idp = $contactid"; $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note";
$result = $db->query($sql); $sql .= " FROM socpeople as p WHERE p.idp = $contactid";
$num = $db->num_rows(); $result = $db->query($sql);
if ( $num >0 ) { $num = $db->num_rows();
$obj = $db->fetch_object( 0);
}
print "<form method=\"post\" action=\"people.php3?socid=$socid\">"; if ( $num >0 )
print '<input type="hidden" name="action" value="update">'; {
print "<input type=\"hidden\" name=\"contactid\" value=\"$contactid\">"; $obj = $db->fetch_object( 0);
print "<table border=0>"; }
print "<tr><td>Numéro</td><td>$obj->idp</td>";
print "<tr><td>Nom</td><td><input name=\"name\" type=\"text\" size=\"20\" maxlength=\"80\" value=\"$obj->name\"></td>"; print "<form method=\"post\" action=\"people.php3?socid=$socid\">";
print "<td>Prenom</td><td><input name=\"firstname\" type=\"text\" size=\"15\" maxlength=\"80\" value=\"$obj->firstname\"></td></tr>"; print '<input type="hidden" name="action" value="update">';
print "<tr><td>Poste</td><td colspan=\"3\"><input name=\"poste\" type=\"text\" size=\"50\" maxlength=\"80\" value=\"$obj->poste\"></td></tr>"; print "<input type=\"hidden\" name=\"contactid\" value=\"$contactid\">";
print "<tr><td>Tel</td><td><input name=\"phone\" type=\"text\" size=\"18\" maxlength=\"80\" value=\"$obj->phone\"></td>"; print "<table border=0>";
print "<td>Fax</td><td><input name=\"fax\" type=\"text\" size=\"18\" maxlength=\"80\" value=\"$obj->fax\"></td></tr>"; print "<tr><td>Numéro</td><td>$obj->idp</td>";
print "<tr><td>Email</td><td colspan=\"3\"><input name=\"email\" type=\"text\" size=\"50\" maxlength=\"80\" value=\"$obj->email\"></td></tr>"; print "<tr><td>Nom</td><td><input name=\"name\" type=\"text\" size=\"20\" maxlength=\"80\" value=\"$obj->name\"></td>";
print '<tr><td valign="top">Note</td><td colspan="3"><textarea wrap="soft" cols="40" rows="10" name="note">'.$obj->note.'</textarea></td></tr>'; print "<td>Prenom</td><td><input name=\"firstname\" type=\"text\" size=\"15\" maxlength=\"80\" value=\"$obj->firstname\"></td></tr>";
print "</table>"; print "<tr><td>Poste</td><td colspan=\"3\"><input name=\"poste\" type=\"text\" size=\"50\" maxlength=\"80\" value=\"$obj->poste\"></td></tr>";
print "<input type=\"submit\" value=\"Modifier\">"; print "<tr><td>Tel</td><td><input name=\"phone\" type=\"text\" size=\"18\" maxlength=\"80\" value=\"$obj->phone\"></td>";
print "</form>"; print "<td>Fax</td><td><input name=\"fax\" type=\"text\" size=\"18\" maxlength=\"80\" value=\"$obj->fax\"></td></tr>";
} print "<tr><td>Email</td><td colspan=\"3\"><input name=\"email\" type=\"text\" size=\"50\" maxlength=\"80\" value=\"$obj->email\"></td></tr>";
print '<tr><td valign="top">Note</td><td colspan="3"><textarea wrap="soft" cols="40" rows="10" name="note">'.$obj->note.'</textarea></td></tr>';
print "</table>";
print "<input type=\"submit\" value=\"Modifier\">";
print "</form>";
}
/* /*
* *
@ -216,39 +231,49 @@ if ($socid > 0) {
$sql .= " AND u.rowid = a.fk_user_author"; $sql .= " AND u.rowid = a.fk_user_author";
$sql .= " AND c.id=a.fk_action "; $sql .= " AND c.id=a.fk_action ";
if ($contactid) { if ($contactid)
$sql .= " AND fk_contact = $contactid"; {
} $sql .= " AND fk_contact = $contactid";
}
$sql .= " ORDER BY a.datea DESC, a.id DESC"; $sql .= " ORDER BY a.datea DESC, a.id DESC";
if ( $db->query($sql) ) { if ( $db->query($sql) )
$i = 0 ; $num = $db->num_rows(); $tag = True; {
while ($i < $num) { $i = 0 ; $num = $db->num_rows(); $tag = True;
$obj = $db->fetch_object( $i); while ($i < $num)
$var=!$var; {
print "<tr $bc[$var]>"; $obj = $db->fetch_object( $i);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>". strftime("%d %b %Y %H:%M", $obj->da) ."</td>"; print "<td>". strftime("%d %b %Y %H:%M", $obj->da) ."</td>";
if ($obj->propalrowid) { if ($obj->propalrowid)
print "<td><a href=\"propal.php3?propalid=$obj->propalrowid\">$obj->libelle</a></td>"; {
} else { print "<td><a href=\"propal.php3?propalid=$obj->propalrowid\">$obj->libelle</a></td>";
print "<td>$obj->libelle</td>"; }
} else
{
print "<td>$obj->libelle</td>";
}
print "<td>$obj->code&nbsp;</td>"; print "<td>$obj->code&nbsp;</td>";
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
$tag = !$tag; $tag = !$tag;
}
}
else
{
print '<tr><td>' . $db->error() . '</td></tr>';
} }
} else {
print '<tr><td>' . $db->error() . '</td></tr>';
}
print "</table>"; print "</table>";
} else { }
else
{
print "Error"; print "Error";
} }
$db->free(); $db->free();

View File

@ -92,175 +92,182 @@ if ($propalid) {
$result = $db->query($sql); $result = $db->query($sql);
if ( $result ) { if ( $result )
$obj = $db->fetch_object( 0 ); {
$obj = $db->fetch_object( 0 );
if ($db->num_rows()) { if ($db->num_rows())
{
$color1 = "#e0e0e0"; $color1 = "#e0e0e0";
print "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">"; print "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">";
print '<tr><td>Société</td><td colspan="2"><a href="fiche.php3?socid='.$obj->idp.'">'.$obj->nom.'</a></td>'; print '<tr><td>Société</td><td colspan="2"><a href="fiche.php3?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
print "<td valign=\"top\" width=\"50%\" rowspan=\"9\">Note :<br>". nl2br($obj->note)."</td></tr>"; print "<td valign=\"top\" width=\"50%\" rowspan=\"9\">Note :<br>". nl2br($obj->note)."</td></tr>";
print '<tr><td>Date</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>'; print '<tr><td>Date</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>';
if ($obj->fk_projet) { if ($obj->fk_projet)
$projet = new Project(); {
$projet->fetch($db,$obj->fk_projet); $projet = new Project($db);
print '<tr><td>Projet</td><td colspan="1">'; $projet->fetch($obj->fk_projet);
print '<a href="projet/fiche.php3?id='.$projet->id.'">'; print '<tr><td>Projet</td><td colspan="1">';
print $projet->title.'</a></td></tr>'; print '<a href="projet/fiche.php3?id='.$projet->id.'">';
} print $projet->title.'</a></td></tr>';
print "<tr><td>Destinataire</td><td colspan=\"2\">$obj->firstname $obj->name &lt;$obj->email&gt;</td></tr>"; }
/* print "<tr><td>Destinataire</td><td colspan=\"2\">$obj->firstname $obj->name &lt;$obj->email&gt;</td></tr>";
* /*
*/ *
*/
print "<tr><td bgcolor=\"$color1\">Montant HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->price)." euros</td></tr>"; print "<tr><td bgcolor=\"$color1\">Montant HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->price)." euros</td></tr>";
/* /*
* *
*/ */
print "<tr><td bgcolor=\"$color1\">Remise</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->remise)." euros</td></tr>"; print "<tr><td bgcolor=\"$color1\">Remise</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->remise)." euros</td></tr>";
/* /*
* *
*/ */
$totalht = $propal->price - $propal->remise ; $totalht = $propal->price - $propal->remise ;
print "<tr><td bgcolor=\"$color1\">Total HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\"><b>".price($totalht)."</b> euros</td></tr>"; print "<tr><td bgcolor=\"$color1\">Total HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\"><b>".price($totalht)."</b> euros</td></tr>";
/* /*
* *
*/ */
print '<tr><td>Auteur</td><td colspan="2">'; print '<tr><td>Auteur</td><td colspan="2">';
$author = new User($db, $obj->fk_user_author); $author = new User($db, $obj->fk_user_author);
$author->fetch(''); $author->fetch('');
print $author->fullname.'</td></tr>'; print $author->fullname.'</td></tr>';
/* /*
* *
*/ */
print "<tr bgcolor=\"#f0f0f0\"><td>Statut :</td><td colspan=2 align=center><b>$obj->lst</b></td>"; print "<tr bgcolor=\"#f0f0f0\"><td>Statut :</td><td colspan=2 align=center><b>$obj->lst</b></td>";
print '</tr>'; print '</tr>';
print "</table>"; print "</table>";
if ($action == 'statut') { if ($action == 'statut')
print "<form action=\"$PHP_SELF?propalid=$propalid\" method=\"post\">"; {
print "<input type=\"hidden\" name=\"action\" value=\"setstatut\">"; print "<form action=\"$PHP_SELF?propalid=$propalid\" method=\"post\">";
print "<select name=\"statut\">"; print "<input type=\"hidden\" name=\"action\" value=\"setstatut\">";
print "<option value=\"2\">Signée"; print "<select name=\"statut\">";
print "<option value=\"3\">Non Signée"; print "<option value=\"2\">Signée";
print '</select>'; print "<option value=\"3\">Non Signée";
print '<br><textarea cols="60" rows="6" wrap="soft" name="note">'; print '</select>';
print $obj->note . "\n----------\n"; print '<br><textarea cols="60" rows="6" wrap="soft" name="note">';
print '</textarea><br><input type="submit" value="Valider">'; print $obj->note . "\n----------\n";
print "</form>"; print '</textarea><br><input type="submit" value="Valider">';
} print "</form>";
}
print "<table width=\"100%\" cellspacing=2><tr><td valign=\"top\">"; print "<table width=\"100%\" cellspacing=2><tr><td valign=\"top\">";
/* /*
* Produits * Produits
*/ */
$sql = "SELECT p.label as product, p.ref, pt.price, pt.qty"; $sql = "SELECT p.label as product, p.ref, pt.price, pt.qty";
$sql .= " FROM llx_propaldet as pt, llx_product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = $propalid"; $sql .= " FROM llx_propaldet as pt, llx_product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = $propalid";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result)
$num = $db->num_rows(); {
$i = 0; $total = 0; $num = $db->num_rows();
print "<p><b>Produits</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">"; $i = 0; $total = 0;
print "<TR class=\"liste_titre\">"; print "<p><b>Produits</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
print "<td>Réf</td><td>Produit</td>"; print "<TR class=\"liste_titre\">";
print "<td align=\"right\">Prix</TD><td align=\"center\">Qté.</td>"; print "<td>Réf</td><td>Produit</td>";
print "</TR>\n"; print "<td align=\"right\">Prix</TD><td align=\"center\">Qté.</td>";
print "</TR>\n";
$var=True; $var=True;
while ($i < $num) {
$objp = $db->fetch_object( $i); while ($i < $num)
$var=!$var; {
print "<TR $bc[$var]>"; $objp = $db->fetch_object( $i);
print "<TD>[$objp->ref]</TD>\n"; $var=!$var;
print "<TD>$objp->product</TD>\n"; print "<TR $bc[$var]>";
print "<TD align=\"right\">".price($objp->price)."</TD><td align=\"center\">".$objp->qty."</td>\n"; print "<TD>[$objp->ref]</TD>\n";
print "</tr>"; print "<TD>$objp->product</TD>\n";
$total = $total + $objp->price; print "<TD align=\"right\">".price($objp->price)."</TD><td align=\"center\">".$objp->qty."</td>\n";
$i++; print "</tr>";
} $total = $total + $objp->price;
//print "<tr><td align=\"right\" colspan=\"3\">Total : <b>".price($total)."</b></td><td>Euros HT</td></tr>\n"; $i++;
print "</table>"; }
} //print "<tr><td align=\"right\" colspan=\"3\">Total : <b>".price($total)."</b></td><td>Euros HT</td></tr>\n";
/* print "</table>";
* }
*/ /*
print "</td></tr>"; *
print "</table>"; */
/* print "</td></tr>";
* Actions print "</table>";
*/ /*
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>"; * Actions
*/
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
if ($obj->statut == 0) {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?propalid=$propalid&action=delete\">Supprimer</a>]</td>";
} else {
if ($obj->statut == 1) {
print "<td bgcolor=\"#e0e0e0\" align=center>[<a href=\"$PHP_SELF?propalid=$propalid&action=statut\">Cloturer</a>]</td>";
} else {
print "<td align=\"center\" width=\"25%\">-</td>";
}
}
if ($obj->statut == 0) {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?propalid=$propalid&action=delete\">Supprimer</a>]</td>";
} else {
if ($obj->statut == 1) {
print "<td bgcolor=\"#e0e0e0\" align=center>[<a href=\"$PHP_SELF?propalid=$propalid&action=statut\">Cloturer</a>]</td>";
} else {
print "<td align=\"center\" width=\"25%\">-</td>"; print "<td align=\"center\" width=\"25%\">-</td>";
}
}
print "<td align=\"center\" width=\"25%\">-</td>"; if ($obj->statut == 1) {
$file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf";
if (file_exists($file)) {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">";
print "[<a href=\"$PHP_SELF?propalid=$propalid&action=presend\">Envoyer la propale par mail</a>]</td>";
} else {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">! Propale non generee !</td>";
}
} else {
print "<td align=\"center\" width=\"25%\">-</td>";
}
if ($obj->statut == 0) {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?propalid=$propalid&valid=1\">Valider</a>]</td>";
} else {
print "<td align=\"center\" width=\"25%\">-</td>";
}
print "</tr></table>";
/*
*
*/
if ($obj->statut == 1) { /*
$file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf"; * Send
if (file_exists($file)) { *
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">"; */
print "[<a href=\"$PHP_SELF?propalid=$propalid&action=presend\">Envoyer la propale par mail</a>]</td>"; if ($action == 'send') {
} else { $file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propal/$obj->ref/$obj->ref.pdf";
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">! Propale non generee !</td>"; if (file_exists($file)) {
}
} else {
print "<td align=\"center\" width=\"25%\">-</td>";
}
if ($obj->statut == 0) {
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?propalid=$propalid&valid=1\">Valider</a>]</td>";
} else {
print "<td align=\"center\" width=\"25%\">-</td>";
}
print "</tr></table>";
/*
*
*/
/* $subject = "Notre proposition commerciale $obj->ref";
* Send $message = "Veuillez trouver ci-joint notre proposition commerciale $obj->ref\n\nCordialement\n\n";
* $filepath = $file ;
*/ $filename = "$obj->ref.pdf";
if ($action == 'send') { $mimetype = "application/pdf";
$file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propal/$obj->ref/$obj->ref.pdf";
if (file_exists($file)) {
$subject = "Notre proposition commerciale $obj->ref"; $replyto = "$replytoname <$replytomail>";
$message = "Veuillez trouver ci-joint notre proposition commerciale $obj->ref\n\nCordialement\n\n";
$filepath = $file ;
$filename = "$obj->ref.pdf";
$mimetype = "application/pdf";
$replyto = "$replytoname <$replytomail>"; $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype, $filename);
$mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype, $filename); if ( $mailfile->sendfile() ) {
if ( $mailfile->sendfile() ) { print "<p>envoy&eacute; &agrave; $sendto";
print "<p>envoy&eacute; par ".htmlentities($replyto);
print "<p>envoy&eacute; &agrave; $sendto";
print "<p>envoy&eacute; par ".htmlentities($replyto);
} else { } else {
print "<b>!! erreur d'envoi"; print "<b>!! erreur d'envoi";
} }

View File

@ -122,13 +122,14 @@ if ($propalid) {
print '<tr><td>'.translate("Date").'</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>'; print '<tr><td>'.translate("Date").'</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>';
if ($obj->fk_projet) { if ($obj->fk_projet)
$projet = new Project(); {
$projet->fetch($db,$obj->fk_projet); $projet = new Project($db);
print '<tr><td>Projet</td><td colspan="1">'; $projet->fetch($obj->fk_projet);
print '<a href="projet/fiche.php3?id='.$projet->id.'">'; print '<tr><td>Projet</td><td colspan="1">';
print $projet->title.'</a></td></tr>'; print '<a href="projet/fiche.php3?id='.$projet->id.'">';
} print $projet->title.'</a></td></tr>';
}
print "<tr><td>Destinataire</td><td colspan=\"2\">$obj->firstname $obj->name &lt;$obj->email&gt;</td></tr>"; print "<tr><td>Destinataire</td><td colspan=\"2\">$obj->firstname $obj->name &lt;$obj->email&gt;</td></tr>";
/* /*
* *

View File

@ -20,7 +20,9 @@
* *
*/ */
class Contact { class Contact
{
var $bs; var $bs;
var $db; var $db;
@ -31,46 +33,71 @@ class Contact {
var $code; var $code;
var $email; var $email;
Function Contact($DB, $id=0) { Function Contact($DB, $id=0)
{
$this->db = $DB; $this->db = $DB;
$this->id = $id; $this->id = $id;
return 1; return 1;
} }
/* /*
* *
* *
* *
*/ */
Function fetch($id) { Function fetch($id)
{
$sql = "SELECT c.idp, c.idp, c.name, c.firstname"; $sql = "SELECT c.idp, c.idp, c.name, c.firstname";
$sql .= " FROM socpeople as c"; $sql .= " FROM socpeople as c";
$sql .= " WHERE c.idp = $id"; $sql .= " WHERE c.idp = $id";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result)
if ($this->db->num_rows()) { {
$obj = $this->db->fetch_object($result , 0); if ($this->db->num_rows())
{
$obj = $this->db->fetch_object($result , 0);
$this->id = $obj->idp; $this->id = $obj->idp;
$this->nom = $obj->name; $this->nom = $obj->name;
$this->prenom = $obj->firstname; $this->prenom = $obj->firstname;
$this->fullname = $this->prenom . ' ' . $this->nom; $this->fullname = $this->prenom . ' ' . $this->nom;
$this->code = $obj->code; $this->code = $obj->code;
$this->email = $obj->email; $this->email = $obj->email;
} }
$this->db->free();
} else { $this->db->free();
print $this->db->error();
}
else
{
print $this->db->error();
}
} }
}
Function update($id)
{
$this->email = trim($this->email);
$sql = "UPDATE socpeople set name='$this->name', firstname='$this->firstname', poste='$this->poste', phone='$this->phone',fax='$this->fax',email='$this->email', note='$this->note'";
$sql .= " WHERE idp=$id";
$result = $this->db->query($sql);
if (!$result)
{
print $this->db->error();
}
return $result;
}
} }