mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-15 05:51:28 +01:00
623 lines
18 KiB
PHP
623 lines
18 KiB
PHP
<?PHP
|
||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||
*
|
||
* $Id$
|
||
* $Source$
|
||
*
|
||
* 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
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* You should have received a copy of the GNU General Public License
|
||
* along with this program; if not, write to the Free Software
|
||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||
*
|
||
*/
|
||
require("./pre.inc.php3");
|
||
|
||
require("../lib/CMailFile.class.php3");
|
||
/*
|
||
* Modules optionnels
|
||
*/
|
||
require("../project.class.php3");
|
||
require("../propal.class.php3");
|
||
require("../actioncomm.class.php3");
|
||
/*
|
||
*
|
||
*/
|
||
|
||
llxHeader();
|
||
|
||
$db = new Db();
|
||
|
||
/******************************************************************************/
|
||
/* Actions */
|
||
/******************************************************************************/
|
||
|
||
if ($action == 'add')
|
||
{
|
||
$propal = new Propal($db, $socidp);
|
||
|
||
$propal->remise = $remise;
|
||
$propal->datep = $db->idate(mktime(12, 1 , 1, $pmonth, $pday, $pyear));
|
||
|
||
$propal->contactid = $contactidp;
|
||
$propal->projetidp = $projetidp;
|
||
|
||
$propal->author = $user->id;
|
||
$propal->note = $note;
|
||
|
||
$propal->ref = $ref;
|
||
|
||
$propal->add_product($idprod1,$qty1);
|
||
$propal->add_product($idprod2,$qty2);
|
||
$propal->add_product($idprod3,$qty3);
|
||
$propal->add_product($idprod4,$qty4);
|
||
|
||
$id = $propal->create();
|
||
|
||
/*
|
||
*
|
||
* Generation
|
||
*
|
||
*/
|
||
if ($id)
|
||
{
|
||
|
||
//$gljroot = "/home/www/dolibarr/dolibarr/htdocs";
|
||
|
||
$command = "export DBI_DSN=\"dbi:mysql:dbname=".$conf->db->name.":host=localhost\" ";
|
||
$command .= " ; ./propal-tex.pl --propal=".$id ." --pdf --ps --output=".$conf->propal->outputdir;
|
||
$command .= " --templates=".$conf->propal->templatesdir;
|
||
|
||
$output = system($command);
|
||
//print "<p>command : $command<br>";
|
||
//print $output;
|
||
|
||
/*
|
||
* Renvoie directement sur la fiche
|
||
*/
|
||
//Header("Location: propal.php3?propalid=$id");
|
||
$propalid = $id;
|
||
}
|
||
else
|
||
{
|
||
print $db->error();
|
||
}
|
||
}
|
||
|
||
|
||
if ($action == 'setstatut')
|
||
{
|
||
/*
|
||
* Cloture de la propale
|
||
*/
|
||
$propal = new Propal($db);
|
||
$propal->id = $propalid;
|
||
$propal->cloture($user->id, $statut, $note);
|
||
|
||
}
|
||
elseif ( $action == 'delete' )
|
||
{
|
||
$sql = "DELETE FROM llx_propal WHERE rowid = $propalid;";
|
||
if ( $db->query($sql) )
|
||
{
|
||
|
||
$sql = "DELETE FROM llx_propaldet WHERE fk_propal = $propalid ;";
|
||
if ( $db->query($sql) )
|
||
{
|
||
print "<b><font color=\"red\">Propal supprim<69>e</font></b>";
|
||
}
|
||
else
|
||
{
|
||
print $db->error();
|
||
print "<p>$sql";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
print $db->error();
|
||
print "<p>$sql";
|
||
}
|
||
$propalid = 0;
|
||
$brouillon = 1;
|
||
}
|
||
|
||
|
||
/******************************************************************************/
|
||
/* Fin des Actions */
|
||
/******************************************************************************/
|
||
/*
|
||
*
|
||
* Mode fiche
|
||
*
|
||
*
|
||
*/
|
||
if ($propalid) {
|
||
$propal = new Propal($db);
|
||
$propal->fetch($propalid);
|
||
|
||
|
||
if ($valid == 1) {
|
||
$propal->valid($user->id);
|
||
}
|
||
/*
|
||
*
|
||
*/
|
||
print "<table width=\"100%\">";
|
||
print "<tr><td><div class=\"titre\">Proposition commerciale : $propal->ref</div></td>";
|
||
print "</table>";
|
||
/*
|
||
*
|
||
*/
|
||
$sql = "SELECT s.nom, s.idp, p.price, p.fk_projet,p.remise, p.tva, p.total, p.ref,".$db->pdate("p.datep")." as dp, c.id as statut, c.label as lst, p.note, x.firstname, x.name, x.fax, x.phone, x.email, p.fk_user_author, p.fk_user_valid, p.fk_user_cloture, p.datec, p.date_valid, p.date_cloture";
|
||
$sql .= " FROM societe as s, llx_propal as p, c_propalst as c, socpeople as x";
|
||
$sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND x.idp = p.fk_soc_contact AND p.rowid = $propalid";
|
||
|
||
$result = $db->query($sql);
|
||
|
||
if ( $result )
|
||
{
|
||
$obj = $db->fetch_object( 0 );
|
||
|
||
if ($db->num_rows())
|
||
{
|
||
|
||
$color1 = "#e0e0e0";
|
||
|
||
print "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">";
|
||
|
||
print '<tr><td>Soci<63>t<EFBFBD></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 '<tr><td>Date</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>';
|
||
|
||
if ($obj->fk_projet)
|
||
{
|
||
$projet = new Project($db);
|
||
$projet->fetch($obj->fk_projet);
|
||
print '<tr><td>Projet</td><td colspan="1">';
|
||
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 <$obj->email></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>";
|
||
|
||
/*
|
||
*
|
||
*/
|
||
|
||
$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>Auteur</td><td colspan="2">';
|
||
$author = new User($db, $obj->fk_user_author);
|
||
$author->fetch('');
|
||
print $author->fullname.'</td></tr>';
|
||
|
||
/*
|
||
*
|
||
*/
|
||
print "<tr bgcolor=\"#f0f0f0\"><td>Statut :</td><td colspan=2 align=center><b>$obj->lst</b></td>";
|
||
|
||
print '</tr>';
|
||
|
||
|
||
print "</table>";
|
||
|
||
if ($action == 'statut')
|
||
{
|
||
print "<form action=\"$PHP_SELF?propalid=$propalid\" method=\"post\">";
|
||
print "<input type=\"hidden\" name=\"action\" value=\"setstatut\">";
|
||
print "<select name=\"statut\">";
|
||
print "<option value=\"2\">Sign<67>e";
|
||
print "<option value=\"3\">Non Sign<67>e";
|
||
print '</select>';
|
||
print '<br><textarea cols="60" rows="6" wrap="soft" name="note">';
|
||
print $obj->note . "\n----------\n";
|
||
print '</textarea><br><input type="submit" value="Valider">';
|
||
print "</form>";
|
||
}
|
||
|
||
|
||
print "<table width=\"100%\" cellspacing=2><tr><td valign=\"top\">";
|
||
/*
|
||
* Produits
|
||
*/
|
||
$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";
|
||
|
||
$result = $db->query($sql);
|
||
if ($result)
|
||
{
|
||
$num = $db->num_rows();
|
||
$i = 0; $total = 0;
|
||
print "<p><b>Produits</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
|
||
print "<TR class=\"liste_titre\">";
|
||
print "<td>R<>f</td><td>Produit</td>";
|
||
print "<td align=\"right\">Prix</TD><td align=\"center\">Qt<51>.</td>";
|
||
print "</TR>\n";
|
||
|
||
$var=True;
|
||
|
||
while ($i < $num)
|
||
{
|
||
$objp = $db->fetch_object( $i);
|
||
$var=!$var;
|
||
print "<TR $bc[$var]>";
|
||
print "<TD>[$objp->ref]</TD>\n";
|
||
print "<TD>$objp->product</TD>\n";
|
||
print "<TD align=\"right\">".price($objp->price)."</TD><td align=\"center\">".$objp->qty."</td>\n";
|
||
print "</tr>";
|
||
$total = $total + $objp->price;
|
||
$i++;
|
||
}
|
||
//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>";
|
||
/*
|
||
* 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>";
|
||
}
|
||
}
|
||
|
||
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>";
|
||
/*
|
||
*
|
||
*/
|
||
|
||
/*
|
||
* Send
|
||
*
|
||
*/
|
||
if ($action == 'send') {
|
||
$file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propal/$obj->ref/$obj->ref.pdf";
|
||
if (file_exists($file)) {
|
||
|
||
$subject = "Notre proposition commerciale $obj->ref";
|
||
$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);
|
||
|
||
if ( $mailfile->sendfile() ) {
|
||
|
||
print "<p>envoyé à $sendto";
|
||
print "<p>envoyé par ".htmlentities($replyto);
|
||
} else {
|
||
print "<b>!! erreur d'envoi";
|
||
}
|
||
}
|
||
/*
|
||
* Enregistre l'action
|
||
*
|
||
* Ne fonctionne pas, a corriger !
|
||
*/
|
||
|
||
if ( $db->query($sql) ) {
|
||
$sql = "INSERT INTO actioncomm (datea,fk_action,fk_soc, propalrowid,note, fk_user_author) ";
|
||
$sql .= " VALUES (now(), 3, $obj->idp, $propalid, 'Envoy<6F>e <20> $sendto',$user->id);";
|
||
if (! $db->query($sql) ) {
|
||
print $db->error();
|
||
print "<p>$sql</p>";
|
||
}
|
||
} else {
|
||
print $db->error();
|
||
}
|
||
}
|
||
/*
|
||
*
|
||
*/
|
||
print "<hr>";
|
||
print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
|
||
print "<b>Documents g<>n<EFBFBD>r<EFBFBD>s</b><br>";
|
||
print "<table width=\"100%\" cellspacing=0 border=1 cellpadding=3>";
|
||
|
||
$file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf";
|
||
if (file_exists($file)) {
|
||
print "<tr><td>Propale PDF</a></td>";
|
||
print '<td><a href="'.$conf->propal->outputurl.'/'.$obj->ref.'/'.$obj->ref.'.pdf">'.$obj->ref.'.pdf</a></td></tr>';
|
||
}
|
||
$file = $conf->propal->outputdir . "/$obj->ref/$obj->ref.ps";
|
||
if (file_exists($file)) {
|
||
print "<tr><td>Propale Postscript</a></td>";
|
||
print '<td><a href="'.$conf->propal->outputurl.'/'.$obj->ref.'/'.$obj->ref.'.ps">'.$obj->ref.'.s</a></td></tr>';
|
||
print "</tr>";
|
||
}
|
||
print '<tr><td colspan="2">(<a href="'.$conf->propal->outputurl.'/'.$obj->ref.'">liste...</a>)</td></tr>';
|
||
|
||
$file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propale/$obj->ref/FAX-$obj->ref.ps";
|
||
if (file_exists($file)) {
|
||
print "<tr><td><a href=\"../../doc/fax/\">FAX d'entete</a></td></tr>";
|
||
}
|
||
print "</table>\n";
|
||
/*
|
||
*
|
||
*/
|
||
print "</td><td valign=\"top\" width=\"50%\">";
|
||
print "<b>Propale envoy<6F>e</b><br>";
|
||
/*
|
||
*
|
||
*/
|
||
$sql = "SELECT ".$db->pdate("a.datea"). " as da, note, fk_user_author" ;
|
||
$sql .= " FROM actioncomm as a WHERE a.fk_soc = $obj->idp AND a.propalrowid = $propalid ";
|
||
|
||
if ( $db->query($sql) ) {
|
||
$num = $db->num_rows();
|
||
$i = 0; $total = 0;
|
||
print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
|
||
print "<tr><td>Date</td><td>Auteur</td></TR>\n";
|
||
|
||
while ($i < $num) {
|
||
$objp = $db->fetch_object( $i);
|
||
print "<TR><TD>".strftime("%d %B %Y %H:%M:%S",$objp->da)."</TD>\n";
|
||
$authoract = new User($db);
|
||
$authoract->id = $objp->fk_user_author;
|
||
$authoract->fetch('');
|
||
print "<TD>$authoract->code</TD></tr>\n";
|
||
print "<tr><td colspan=\"2\">$objp->note</td></tr>";
|
||
$i++;
|
||
}
|
||
print "</table>";
|
||
$db->free();
|
||
} else {
|
||
print $db->error();
|
||
}
|
||
/*
|
||
*
|
||
*/
|
||
print "</td></tr></table>";
|
||
/*
|
||
*
|
||
*
|
||
*/
|
||
if ($action == 'presend') {
|
||
$sendto = "rq@lolix.org";
|
||
|
||
$replytoname = $conf->propal->replytoname;
|
||
$replytomail = $conf->propal->replytomail;
|
||
|
||
$from_name = $user->fullname ; //$conf->propal->fromtoname;
|
||
$from_mail = $user->email; //conf->propal->fromtomail;
|
||
|
||
print "<form method=\"post\" action=\"$PHP_SELF?propalid=$propalid&action=send\">\n";
|
||
print "<input type=\"hidden\" name=\"sendto\" value=\"$sendto\">\n";
|
||
print "<input type=\"hidden\" name=\"replytoname\" value=\"$replytoname\">\n";
|
||
print "<input type=\"hidden\" name=\"replytomail\" value=\"$replytomail\">\n";
|
||
|
||
print "<p><b>Envoyer la propale par mail</b>";
|
||
print "<table cellspacing=0 border=1 cellpadding=3>";
|
||
print "<tr><td>Destinataire</td><td colspan=\"5\">$obj->firstname $obj->name</td>";
|
||
print "<td><input size=\"30\" name=\"sendto\" value=\"$obj->email\"></td></tr>";
|
||
print "<tr><td>Expediteur</td><td colspan=\"5\">$from_name</td><td>$from_mail</td></tr>";
|
||
print "<tr><td>Reply-to</td><td colspan=\"5\">$replytoname</td>";
|
||
print "<td>$replytomail</td></tr>";
|
||
|
||
print "</table>";
|
||
print "<input type=\"submit\" value=\"Envoyer\">";
|
||
print "</form>";
|
||
}
|
||
|
||
} else {
|
||
print "Num rows = " . $db->num_rows();
|
||
print "<p><b>$sql";
|
||
}
|
||
/*
|
||
* Voir le suivi des actions
|
||
*
|
||
*
|
||
*
|
||
*/
|
||
if ($suivi) {
|
||
$validor = new User($db, $obj->fk_user_valid);
|
||
$validor->fetch('');
|
||
$cloturor = new User($db, $obj->fk_user_cloture);
|
||
$cloturor->fetch('');
|
||
|
||
print 'Suivi des actions<br>';
|
||
print '<table cellspacing=0 border=1 cellpadding=3>';
|
||
print '<tr><td> </td><td>Nom</td><td>Date</td></tr>';
|
||
print '<tr><td>Cr<43>ation</td><td>'.$author->fullname.'</td>';
|
||
print '<td>'.$obj->datec.'</td></tr>';
|
||
|
||
print '<tr><td>Validation</td><td>'.$validor->fullname.' </td>';
|
||
print '<td>'.$obj->date_valid.' </td></tr>';
|
||
|
||
print '<tr><td>Cloture</td><td>'.$cloturor->fullname.' </td>';
|
||
print '<td>'.$obj->date_cloture.' </td></tr>';
|
||
print '</table>';
|
||
} else {
|
||
print '<p><a href="'.$PHP_SELF.'?propalid='.$propal->id.'&suivi=1">Voir le suivi des actions </a>';
|
||
}
|
||
|
||
} else {
|
||
print $db->error();
|
||
print "<p><b>$sql";
|
||
}
|
||
|
||
|
||
/*
|
||
*
|
||
*
|
||
*
|
||
*/
|
||
} else {
|
||
/*
|
||
*
|
||
*
|
||
* Mode Liste des propales
|
||
*
|
||
*
|
||
*/
|
||
|
||
if ($sortfield == "") {
|
||
$sortfield="p.fk_statut, datep ";
|
||
}
|
||
if ($sortorder == "") {
|
||
$sortorder="ASC";
|
||
}
|
||
|
||
if ($page == -1) { $page = 0 ; }
|
||
$limit = 26;
|
||
$offset = $limit * $page ;
|
||
$pageprev = $page - 1;
|
||
$pagenext = $page + 1;
|
||
|
||
print "<table width=\"100%\">";
|
||
print "<tr><td><div class=\"titre\">Propositions commerciales</div></td>";
|
||
print "</table>";
|
||
|
||
$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price - p.remise as price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
|
||
$sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
|
||
|
||
if ($socidp) {
|
||
$sql .= " AND s.idp = $socidp";
|
||
}
|
||
|
||
if ($viewstatut <> '') {
|
||
$sql .= " AND c.id = $viewstatut";
|
||
}
|
||
|
||
if ($month > 0) {
|
||
$sql .= " AND date_format(p.datep, '%Y-%m') = '$year-$month'";
|
||
}
|
||
if ($year > 0) {
|
||
$sql .= " AND date_format(p.datep, '%Y') = $year";
|
||
}
|
||
|
||
$sql .= " ORDER BY $sortfield ASC";
|
||
|
||
if ( $db->query($sql) ) {
|
||
$num = $db->num_rows();
|
||
$i = 0;
|
||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||
|
||
$oldstatut = -1;
|
||
$subtotal = 0;
|
||
while ($i < $num) {
|
||
$objp = $db->fetch_object( $i);
|
||
|
||
if ($objp->statut <> $oldstatut ) {
|
||
$oldstatut = $objp->statut;
|
||
|
||
if ($i > 0) {
|
||
print "<tr><td align=\"right\" colspan=\"5\">Total : <b>".price($subtotal)."</b></td>\n";
|
||
print "<td align=\"left\">Euros HT</td></tr>\n";
|
||
}
|
||
$subtotal = 0;
|
||
|
||
print '<TR class="liste_titre">';
|
||
print "<TD>R<>f</TD><td>";
|
||
print_liste_field_titre ("Soci<EFBFBD>t<EFBFBD>",$PHP_SELF,"s.nom");
|
||
print "</td><TD align=\"right\" colspan=\"2\">Date</TD>";
|
||
print "<TD align=\"right\">Prix</TD>";
|
||
print "<TD align=\"center\">Statut <a href=\"$PHP_SELF?viewstatut=$objp->statutid\">";
|
||
print '<img src="/theme/'.$conf->theme.'/img/filter.png" border="0"></a></td>';
|
||
print "</TR>\n";
|
||
$var=True;
|
||
}
|
||
|
||
$var=!$var;
|
||
print "<TR $bc[$var]>";
|
||
print "<TD><a href=\"$PHP_SELF?propalid=$objp->propalid\">$objp->ref</a></TD>\n";
|
||
print "<TD><a href=\"fiche.php3?socid=$objp->idp\">$objp->nom</a></TD>\n";
|
||
|
||
$now = time();
|
||
$lim = 3600 * 24 * 15 ;
|
||
|
||
if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) {
|
||
print "<td><b> > 15 jours</b></td>";
|
||
} else {
|
||
print "<td> </td>";
|
||
}
|
||
|
||
print "<TD align=\"right\">";
|
||
$y = strftime("%Y",$objp->dp);
|
||
$m = strftime("%m",$objp->dp);
|
||
|
||
print strftime("%d",$objp->dp)."\n";
|
||
print " <a href=\"propal.php3?year=$y&month=$m\">";
|
||
print strftime("%B",$objp->dp)."</a>\n";
|
||
print " <a href=\"propal.php3?year=$y\">";
|
||
print strftime("%Y",$objp->dp)."</a></TD>\n";
|
||
|
||
print "<TD align=\"right\">".price($objp->price)."</TD>\n";
|
||
print "<TD align=\"center\">$objp->statut</TD>\n";
|
||
print "</TR>\n";
|
||
|
||
$total = $total + $objp->price;
|
||
$subtotal = $subtotal + $objp->price;
|
||
|
||
$i++;
|
||
}
|
||
print "<tr><td align=\"right\" colspan=\"5\">Total : <b>".price($subtotal)."</b></td>\n";
|
||
print "<td align=\"left\">Euros HT</td></tr>\n";
|
||
|
||
|
||
print "<tr><td></td><td>$i propales</td>";
|
||
print "<td colspan=\"3\" align=\"right\"><b>Total : ".price($total)."</b></td>";
|
||
print "<td align=\"left\"><b>Euros HT</b></td></tr>";
|
||
print "</TABLE>";
|
||
$db->free();
|
||
} else {
|
||
print $db->error();
|
||
}
|
||
}
|
||
$db->close();
|
||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||
?>
|