2002-04-30 12:44:42 +02:00
< ? 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
*/
2002-05-11 20:53:13 +02:00
require ( " ../project.class.php3 " );
require ( " ../propal.class.php3 " );
require ( " ../actioncomm.class.php3 " );
2002-04-30 12:44:42 +02:00
/*
*
*/
llxHeader ();
2002-05-01 02:11:24 +02:00
2002-04-30 12:44:42 +02:00
$db = new Db ();
2002-12-12 18:04:27 +01:00
/******************************************************************************/
/* Actions */
/******************************************************************************/
2002-04-30 12:44:42 +02:00
2002-12-12 18:04:27 +01:00
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' )
{
2002-05-01 02:11:24 +02:00
/*
* Cloture de la propale
*/
$propal = new Propal ( $db );
$propal -> id = $propalid ;
$propal -> cloture ( $user -> id , $statut , $note );
2002-12-12 18:04:27 +01:00
}
elseif ( $action == 'delete' )
{
2002-04-30 12:44:42 +02:00
$sql = " DELETE FROM llx_propal WHERE rowid = $propalid ; " ;
2002-12-12 18:04:27 +01:00
if ( $db -> query ( $sql ) )
{
2002-04-30 12:44:42 +02:00
2002-12-12 18:04:27 +01:00
$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
{
2002-04-30 12:44:42 +02:00
print $db -> error ();
print " <p> $sql " ;
2002-12-12 18:04:27 +01:00
}
2002-04-30 12:44:42 +02:00
$propalid = 0 ;
$brouillon = 1 ;
}
2002-12-12 18:04:27 +01:00
/******************************************************************************/
/* Fin des Actions */
/******************************************************************************/
2002-05-04 01:01:45 +02:00
/*
*
* Mode fiche
*
*
*/
2002-04-30 12:44:42 +02:00
if ( $propalid ) {
2002-05-04 01:01:45 +02:00
$propal = new Propal ( $db );
$propal -> fetch ( $propalid );
2002-04-30 12:44:42 +02:00
2002-05-04 01:01:45 +02:00
if ( $valid == 1 ) {
$propal -> valid ( $user -> id );
2002-04-30 12:44:42 +02:00
}
2002-05-04 01:01:45 +02:00
/*
*
*/
print " <table width= \" 100% \" > " ;
print " <tr><td><div class= \" titre \" >Proposition commerciale : $propal->ref </div></td> " ;
print " </table> " ;
2002-04-30 12:44:42 +02:00
/*
*
*/
2002-05-01 02:11:24 +02:00
$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 " ;
2002-04-30 12:44:42 +02:00
$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 );
2002-12-12 17:11:54 +01:00
if ( $result )
{
$obj = $db -> fetch_object ( 0 );
2002-04-30 12:44:42 +02:00
2002-12-12 17:11:54 +01:00
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> " ;
}
}
2002-05-04 23:28:42 +02:00
print " <td align= \" center \" width= \" 25% \" >-</td> " ;
2002-12-12 17:11:54 +01:00
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 );
2002-04-30 12:44:42 +02:00
} else {
print " <b>!! erreur d'envoi " ;
}
}
2002-05-02 20:04:23 +02:00
/*
* Enregistre l ' action
*
* Ne fonctionne pas , a corriger !
*/
2002-04-30 12:44:42 +02:00
if ( $db -> query ( $sql ) ) {
2002-05-02 20:04:23 +02:00
$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 ); " ;
2002-04-30 12:44:42 +02:00
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> " ;
2002-05-01 02:11:24 +02:00
$file = $conf -> propal -> outputdir . " / $obj->ref / $obj->ref .pdf " ;
2002-04-30 12:44:42 +02:00
if ( file_exists ( $file )) {
2002-05-01 02:36:56 +02:00
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>' ;
2002-04-30 12:44:42 +02:00
}
2002-05-01 02:36:56 +02:00
$file = $conf -> propal -> outputdir . " / $obj->ref / $obj->ref .ps " ;
2002-04-30 12:44:42 +02:00
if ( file_exists ( $file )) {
2002-05-01 02:36:56 +02:00
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>' ;
2002-04-30 12:44:42 +02:00
print " </tr> " ;
}
2002-05-01 02:11:24 +02:00
print '<tr><td colspan="2">(<a href="' . $conf -> propal -> outputurl . '/' . $obj -> ref . '">liste...</a>)</td></tr>' ;
2002-04-30 12:44:42 +02:00
$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> " ;
/*
*
*/
2002-05-02 20:04:23 +02:00
$sql = " SELECT " . $db -> pdate ( " a.datea " ) . " as da, note, fk_user_author " ;
2002-04-30 12:44:42 +02:00
$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 " ;
2002-05-02 20:04:23 +02:00
$authoract = new User ( $db );
$authoract -> id = $objp -> fk_user_author ;
$authoract -> fetch ( '' );
print " <TD> $authoract->code </TD></tr> \n " ;
2002-04-30 12:44:42 +02:00
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 " ;
2002-05-02 20:04:23 +02:00
$replytoname = $conf -> propal -> replytoname ;
$replytomail = $conf -> propal -> replytomail ;
$from_name = $user -> fullname ; //$conf->propal->fromtoname;
$from_mail = $user -> email ; //conf->propal->fromtomail;
2002-04-30 12:44:42 +02:00
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 " ;
}
2002-05-04 01:01:45 +02:00
/*
* 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 ( '' );
2002-05-04 23:28:42 +02:00
print 'Suivi des actions<br>' ;
2002-05-04 01:01:45 +02:00
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>' ;
}
2002-05-01 02:11:24 +02:00
2002-04-30 12:44:42 +02:00
} else {
print $db -> error ();
print " <p><b> $sql " ;
}
/*
*
*
*
*/
} else {
/*
*
*
2002-05-04 01:01:45 +02:00
* Mode Liste des propales
2002-04-30 12:44:42 +02:00
*
*
*/
2002-07-29 12:26:12 +02:00
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 ;
2002-05-04 01:01:45 +02:00
print " <table width= \" 100% \" > " ;
print " <tr><td><div class= \" titre \" >Propositions commerciales</div></td> " ;
print " </table> " ;
2002-04-30 12:44:42 +02:00
$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 " ;
2002-05-02 20:04:23 +02:00
if ( $socidp ) {
$sql .= " AND s.idp = $socidp " ;
}
2002-04-30 12:44:42 +02:00
2002-05-02 20:04:23 +02:00
if ( $viewstatut <> '' ) {
$sql .= " AND c.id = $viewstatut " ;
}
2002-04-30 12:44:42 +02:00
if ( $month > 0 ) {
$sql .= " AND date_format(p.datep, '%Y-%m') = ' $year - $month ' " ;
}
if ( $year > 0 ) {
$sql .= " AND date_format(p.datep, '%Y') = $year " ;
}
2002-07-29 12:26:12 +02:00
$sql .= " ORDER BY $sortfield ASC " ;
2002-04-30 12:44:42 +02:00
if ( $db -> query ( $sql ) ) {
$num = $db -> num_rows ();
$i = 0 ;
2002-05-06 21:10:48 +02:00
print " <TABLE border= \" 0 \" width= \" 100% \" cellspacing= \" 0 \" cellpadding= \" 4 \" > " ;
2002-04-30 12:44:42 +02:00
$oldstatut = - 1 ;
$subtotal = 0 ;
while ( $i < $num ) {
$objp = $db -> fetch_object ( $i );
if ( $objp -> statut <> $oldstatut ) {
$oldstatut = $objp -> statut ;
if ( $i > 0 ) {
2002-05-06 21:10:48 +02:00
print " <tr><td align= \" right \" colspan= \" 5 \" >Total : <b> " . price ( $subtotal ) . " </b></td> \n " ;
2002-04-30 12:44:42 +02:00
print " <td align= \" left \" >Euros HT</td></tr> \n " ;
}
$subtotal = 0 ;
2002-05-06 21:10:48 +02:00
print '<TR class="liste_titre">' ;
2002-07-29 12:26:12 +02:00
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> " ;
2002-04-30 12:44:42 +02:00
print " <TD align= \" right \" >Prix</TD> " ;
2002-05-06 21:10:48 +02:00
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>' ;
2002-04-30 12:44:42 +02:00
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 " ;
2002-05-10 14:28:10 +02:00
print " <TD><a href= \" fiche.php3?socid= $objp->idp\ " > $objp -> nom </ a ></ TD > \n " ;
2002-04-30 12:44:42 +02:00
$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\ " > " ;
2002-05-06 21:10:48 +02:00
print strftime ( " %Y " , $objp -> dp ) . " </a></TD> \n " ;
2002-04-30 12:44:42 +02:00
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 ++ ;
}
2002-05-06 21:10:48 +02:00
print " <tr><td align= \" right \" colspan= \" 5 \" >Total : <b> " . price ( $subtotal ) . " </b></td> \n " ;
2002-04-30 12:44:42 +02:00
print " <td align= \" left \" >Euros HT</td></tr> \n " ;
2002-05-06 21:10:48 +02:00
print " <tr><td></td><td> $i propales</td> " ;
2002-04-30 12:44:42 +02:00
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> " );
?>