*** empty log message ***
This commit is contained in:
parent
f9173b03f9
commit
aa593d4af0
@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
require("./pre.inc.php3");
|
require("./pre.inc.php3");
|
||||||
require("../facture.class.php3");
|
require("../facture.class.php3");
|
||||||
|
require("../lib/CMailFile.class.php3");
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
@ -127,6 +128,58 @@ if ($action == 'add')
|
|||||||
$action = '';
|
$action = '';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($action == 'send')
|
||||||
|
{
|
||||||
|
$fac = new Facture($db,"",$facid);
|
||||||
|
$fac->fetch($facid);
|
||||||
|
|
||||||
|
$soc = new Societe($db, $fac->socidp);
|
||||||
|
|
||||||
|
$file = $conf->facture->outputdir . "/" . $fac->ref . "/" . $fac->ref . ".pdf";
|
||||||
|
|
||||||
|
if (file_exists($file))
|
||||||
|
{
|
||||||
|
|
||||||
|
$sendto = $soc->contact_get_email($HTTP_POST_VARS["destinataire"]);
|
||||||
|
|
||||||
|
if (strlen($sendto))
|
||||||
|
{
|
||||||
|
|
||||||
|
$subject = "Facture $fac->ref";
|
||||||
|
$message = "Veuillez trouver ci-joint la facture $fac->ref\n\nCordialement\n\n";
|
||||||
|
$filename = "$fac->ref.pdf";
|
||||||
|
|
||||||
|
$replyto = $HTTP_POST_VARS["replytoname"] . " <".$HTTP_POST_VARS["replytomail"] .">";
|
||||||
|
|
||||||
|
$mailfile = new CMailFile($subject,$sendto,$replyto,$message,$file, "application/pdf", $filename);
|
||||||
|
|
||||||
|
if ( $mailfile->sendfile() )
|
||||||
|
{
|
||||||
|
|
||||||
|
$sql = "INSERT INTO actioncomm (datea,fk_action,fk_soc,note,fk_facture) VALUES (now(), 9 ,$fac->socidp ,'Envoyée à $sendndto',$fac->id);";
|
||||||
|
|
||||||
|
if (! $db->query($sql) )
|
||||||
|
{
|
||||||
|
print $db->error();
|
||||||
|
print "<p>$sql</p>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<b>!! erreur d'envoi<br>$sendto<br>$replyto<br>$filename";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "Can't get email $sendto";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Mode creation
|
* Mode creation
|
||||||
@ -255,6 +308,8 @@ else
|
|||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$soc = new Societe($db, $obj->socidp);
|
||||||
|
|
||||||
$author = new User($db);
|
$author = new User($db);
|
||||||
$author->id = $obj->fk_user_author;
|
$author->id = $obj->fk_user_author;
|
||||||
$author->fetch();
|
$author->fetch();
|
||||||
@ -357,9 +412,9 @@ else
|
|||||||
|
|
||||||
echo '<TABLE border="0" width="100%" cellspacing="0" cellpadding="3">';
|
echo '<TABLE border="0" width="100%" cellspacing="0" cellpadding="3">';
|
||||||
print "<TR class=\"liste_titre\">";
|
print "<TR class=\"liste_titre\">";
|
||||||
print "<td>Date</td>";
|
print '<td width="60%">Description</td>';
|
||||||
print '<td align="center">Quantité</td>';
|
print '<td width="8%"align="center">Quantité</td>';
|
||||||
print '<td align="right">Montant</TD><td> </td><td> </td>';
|
print '<td width="12%" align="right">Montant</TD><td width="10%"> </td><td width="10%"> </td>';
|
||||||
print "</TR>\n";
|
print "</TR>\n";
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
@ -375,6 +430,10 @@ else
|
|||||||
print '<td align="right"><a href="'.$PHPSELF.'?facid='.$facid.'&action=deleteline&rowid='.$objp->rowid.'">del</a></td>';
|
print '<td align="right"><a href="'.$PHPSELF.'?facid='.$facid.'&action=deleteline&rowid='.$objp->rowid.'">del</a></td>';
|
||||||
print '<td align="right"><a href="'.$PHPSELF.'?facid='.$facid.'&action=editline&rowid='.$objp->rowid.'">edit</a></td>';
|
print '<td align="right"><a href="'.$PHPSELF.'?facid='.$facid.'&action=editline&rowid='.$objp->rowid.'">edit</a></td>';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td> </td><td> </td>';
|
||||||
|
}
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
if ($action == 'editline' && $rowid == $objp->rowid)
|
if ($action == 'editline' && $rowid == $objp->rowid)
|
||||||
@ -412,7 +471,7 @@ else
|
|||||||
print "<form action=\"$PHP_SELF?facid=$facid\" method=\"post\">";
|
print "<form action=\"$PHP_SELF?facid=$facid\" method=\"post\">";
|
||||||
echo '<TABLE border="1" width="100%" cellspacing="0" cellpadding="1">';
|
echo '<TABLE border="1" width="100%" cellspacing="0" cellpadding="1">';
|
||||||
print "<TR class=\"liste_titre\">";
|
print "<TR class=\"liste_titre\">";
|
||||||
print "<td>Date</td>";
|
print "<td>Description</td>";
|
||||||
print "<td>Quantité</td>";
|
print "<td>Quantité</td>";
|
||||||
print "<td align=\"right\">Montant</TD>";
|
print "<td align=\"right\">Montant</TD>";
|
||||||
print "</TR>\n";
|
print "</TR>\n";
|
||||||
@ -437,6 +496,10 @@ else
|
|||||||
{
|
{
|
||||||
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?facid=$facid&action=delete\">Supprimer</a>]</td>";
|
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?facid=$facid&action=delete\">Supprimer</a>]</td>";
|
||||||
}
|
}
|
||||||
|
elseif ($obj->statut == 1 && $resteapayer > 0)
|
||||||
|
{
|
||||||
|
print "<td align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?facid=$facid&action=presend\">Envoyer</a>]</td>";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||||
@ -475,16 +538,16 @@ else
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
print "<hr>";
|
print "<hr>";
|
||||||
print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
|
print "<table width=\"100%\" cellspacing=2><tr><td width=\"60%\" valign=\"top\">";
|
||||||
print "<b>Documents générés</b><br>";
|
print_titre("Documents générés");
|
||||||
print "<table width=\"100%\" cellspacing=0 border=1 cellpadding=3>";
|
print '<table width="100%" cellspacing="0" border="1" cellpadding="3">';
|
||||||
|
|
||||||
$file = $conf->facture->outputdir . "/" . $obj->facnumber . "/" . $obj->facnumber . ".pdf";
|
$file = $conf->facture->outputdir . "/" . $obj->facnumber . "/" . $obj->facnumber . ".pdf";
|
||||||
|
|
||||||
|
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
print "<tr><td>Propale PDF</a></td>";
|
print "<tr $bc[0]><td>Facture PDF</a></td>";
|
||||||
print '<td><a href="'.$conf->facture->outputurl."/".$obj->facnumber."/".$obj->facnumber.'.pdf">'.$obj->facnumber.'.pdf</a></td>';
|
print '<td><a href="'.$conf->facture->outputurl."/".$obj->facnumber."/".$obj->facnumber.'.pdf">'.$obj->facnumber.'.pdf</a></td>';
|
||||||
print '<td align="right">'.filesize($file). ' bytes</td>';
|
print '<td align="right">'.filesize($file). ' bytes</td>';
|
||||||
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
|
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
|
||||||
@ -495,17 +558,65 @@ else
|
|||||||
|
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
print "<tr><td>Propale Postscript</a></td>";
|
print "<tr $bc[0]><td>Facture Postscript</a></td>";
|
||||||
print '<td><a href="'.$conf->facture->outputurl."/".$obj->facnumber."/".$obj->facnumber.'.ps">'.$obj->facnumber.'.ps</a></td>';
|
print '<td><a href="'.$conf->facture->outputurl."/".$obj->facnumber."/".$obj->facnumber.'.ps">'.$obj->facnumber.'.ps</a></td>';
|
||||||
print '<td align="right">'.filesize($file). ' bytes</td>';
|
print '<td align="right">'.filesize($file). ' bytes</td>';
|
||||||
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
|
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
print '<tr><td colspan="2">(<a href="'.$conf->facture->outputurl.'/'.$facid.'/">liste...</a>)</td></tr>';
|
print '<tr $bc[0]><td colspan="4">(<a href="'.$conf->facture->outputurl.'/'.$facid.'/">liste...</a>)</td></tr>';
|
||||||
|
|
||||||
print "</table>\n</table>";
|
print "</table>\n";
|
||||||
|
print "</td>";
|
||||||
|
print '<td valign="top" width="40%">';
|
||||||
|
print_titre("Actions");
|
||||||
|
/*
|
||||||
|
* Liste des actions
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$sql = "SELECT ".$db->pdate("a.datea")." as da, a.note";
|
||||||
|
$sql .= " FROM actioncomm as a WHERE a.fk_soc = $obj->socidp AND a.fk_action = 9 AND a.fk_facture = $facid";
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows();
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
$i = 0; $total = 0;
|
||||||
|
print '<TABLE border="1" cellspacing="0" cellpadding="4">';
|
||||||
|
print "<TR $bc[$var]>";
|
||||||
|
print "<td>Date</td>";
|
||||||
|
print "<td>Action</td>";
|
||||||
|
print "</TR>\n";
|
||||||
|
|
||||||
|
$var=True;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object( $i);
|
||||||
|
$var=!$var;
|
||||||
|
print "<TR $bc[$var]>";
|
||||||
|
print "<TD>".strftime("%d %B %Y",$objp->da)."</TD>\n";
|
||||||
|
print '<TD align="right">'.stripslashes($objp->note).'</TD>';
|
||||||
|
print "</tr>";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
print "</table>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $db->error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
print "</td></tr>";
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generation de la facture
|
* Generation de la facture
|
||||||
@ -513,7 +624,7 @@ else
|
|||||||
*/
|
*/
|
||||||
if ($action == 'pdf')
|
if ($action == 'pdf')
|
||||||
{
|
{
|
||||||
print "<hr><b>Génération de la facture</b><br>";
|
print "<hr><b>Génération de la facture</b><br><small><pre>";
|
||||||
$command = "export DBI_DSN=\"dbi:mysql:dbname=".$conf->db->name."\" ";
|
$command = "export DBI_DSN=\"dbi:mysql:dbname=".$conf->db->name."\" ";
|
||||||
$command .= " ; ./texfacture.pl --html -vv --facture=$facid --pdf --output=".$conf->facture->outputdir;
|
$command .= " ; ./texfacture.pl --html -vv --facture=$facid --pdf --output=".$conf->facture->outputdir;
|
||||||
$command .= " --templates=".$conf->facture->templatesdir;
|
$command .= " --templates=".$conf->facture->templatesdir;
|
||||||
@ -521,7 +632,46 @@ else
|
|||||||
$output = system($command);
|
$output = system($command);
|
||||||
print "<p>command :<br><small>$command</small><br>";
|
print "<p>command :<br><small>$command</small><br>";
|
||||||
//print "<p>output :<br><small>$output</small><br>";
|
//print "<p>output :<br><small>$output</small><br>";
|
||||||
|
print "</pre></small>";
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if ($action == 'presend')
|
||||||
|
{
|
||||||
|
$replytoname = "R. Quiedeville";
|
||||||
|
$from_name = $replytoname;
|
||||||
|
$replytomail = "rq@quiedeville.org";
|
||||||
|
$from_mail = $replytomail;
|
||||||
|
|
||||||
|
print "<form method=\"post\" action=\"$PHP_SELF?facid=$facid&action=send\">\n";
|
||||||
|
print "<input type=\"hidden\" name=\"replytoname\" value=\"$replytoname\">\n";
|
||||||
|
print "<input type=\"hidden\" name=\"replytomail\" value=\"$replytomail\">\n";
|
||||||
|
|
||||||
|
print "<p><b>Envoyer la facture par mail</b>";
|
||||||
|
print "<table cellspacing=0 border=1 cellpadding=3>";
|
||||||
|
print '<tr><td>Destinataire</td><td colspan="5">';
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
$form->select_array("destinataire",$soc->contact_email_array());
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
print "<td><input size=\"30\" name=\"sendto\" value=\"$obj->email\"></td></tr>";
|
||||||
|
print "<tr><td>Expéditeur</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>";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -306,7 +306,7 @@ if ($socid > 0) {
|
|||||||
print "<tr><td><b>Prénom Nom</b></td>";
|
print "<tr><td><b>Prénom Nom</b></td>";
|
||||||
print '<td><b>Poste</b></td><td><b>Tél</b></td>';
|
print '<td><b>Poste</b></td><td><b>Tél</b></td>';
|
||||||
print "<td><b>Fax</b></td><td><b>Email</b></td>";
|
print "<td><b>Fax</b></td><td><b>Email</b></td>";
|
||||||
print "<td><a href=\"people.php3?socid=$objsoc->idp&action=addcontact\">Ajouter</a></td></tr>";
|
print "<td><a href=\"../comm/people.php3?socid=$objsoc->idp&action=addcontact\">Ajouter</a></td></tr>";
|
||||||
|
|
||||||
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM socpeople as p WHERE p.fk_soc = $objsoc->idp ORDER by p.datec";
|
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM socpeople as p WHERE p.fk_soc = $objsoc->idp ORDER by p.datec";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -331,7 +331,7 @@ if ($socid > 0) {
|
|||||||
print '<td><a href="action/fiche.php3?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->phone.'</a> </td>';
|
print '<td><a href="action/fiche.php3?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->phone.'</a> </td>';
|
||||||
print '<td><a href="action/fiche.php3?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->fax.'</a> </td>';
|
print '<td><a href="action/fiche.php3?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->fax.'</a> </td>';
|
||||||
print '<td><a href="action/fiche.php3?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->email.'</a> </td>';
|
print '<td><a href="action/fiche.php3?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->email.'</a> </td>';
|
||||||
print "<td><a href=\"people.php3?socid=$objsoc->idp&action=editcontact&contactid=$obj->idp\">Modifier</a></td>";
|
print "<td><a href=\"../comm/people.php3?socid=$objsoc->idp&action=editcontact&contactid=$obj->idp\">Modifier</a></td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
$tag = !$tag;
|
$tag = !$tag;
|
||||||
|
|||||||
@ -52,12 +52,15 @@ if ($action == 'del_bookmark') {
|
|||||||
$sql = "DELETE FROM llx_bookmark WHERE rowid=$bid";
|
$sql = "DELETE FROM llx_bookmark WHERE rowid=$bid";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
print_titre(translate("Espace compta"));
|
print_titre(translate("Espace compta"));
|
||||||
|
|
||||||
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
|
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
|
||||||
|
|
||||||
print '<tr><td valign="top" width="30%">';
|
print '<tr><td valign="top" width="33%">';
|
||||||
/*
|
/*
|
||||||
* Charges a payer
|
* Charges a payer
|
||||||
*
|
*
|
||||||
@ -163,7 +166,7 @@ if ( $db->query($sql) ) {
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
print '</td><td valign="top" width="70%">';
|
print '</td><td valign="top" width="33%">';
|
||||||
|
|
||||||
|
|
||||||
$result = 0;
|
$result = 0;
|
||||||
@ -187,9 +190,49 @@ if ( $result ) {
|
|||||||
} else {
|
} else {
|
||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Charges a payer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$sql = "SELECT ff.amount, ff.libelle";
|
||||||
|
$sql .= " FROM llx_facture_fourn as ff";
|
||||||
|
$sql .= " WHERE ff.paye=0";
|
||||||
|
|
||||||
print '</td></tr>';
|
if ( $db->query($sql) )
|
||||||
|
{
|
||||||
|
$num = $db->num_rows();
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
print '<table border="0" width="100%" cellspacing="0" cellpadding="4">';
|
||||||
|
print '<TR class="liste_titre">';
|
||||||
|
print '<TD colspan="2">Charges à payer</td>';
|
||||||
|
print "</TR>\n";
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object( $i);
|
||||||
|
$var = !$var;
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td>'.$obj->libelle.'</td>';
|
||||||
|
print '<td align="right">'.price($obj->amount).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
print '</table><br>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $db->error();
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td><td width="40%"> </td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|||||||
@ -110,7 +110,7 @@ class Facture {
|
|||||||
Function fetch($rowid)
|
Function fetch($rowid)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "SELECT ref,price,remise,".$this->db->pdate(datep)."as dp FROM llx_facture WHERE rowid=$rowid;";
|
$sql = "SELECT fk_soc,facnumber,amount,remise,".$this->db->pdate(datef)."as df FROM llx_facture WHERE rowid=$rowid;";
|
||||||
|
|
||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
@ -118,11 +118,12 @@ class Facture {
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object(0);
|
$obj = $this->db->fetch_object(0);
|
||||||
|
|
||||||
$this->id = $rowid;
|
$this->id = $rowid;
|
||||||
$this->datep = $obj->dp;
|
$this->datep = $obj->dp;
|
||||||
$this->ref = $obj->ref;
|
$this->ref = $obj->facnumber;
|
||||||
$this->price = $obj->price;
|
|
||||||
$this->remise = $obj->remise;
|
$this->remise = $obj->remise;
|
||||||
|
$this->socidp = $obj->fk_soc;
|
||||||
|
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,12 +25,6 @@ require("../../contact.class.php3");
|
|||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
$db = new Db();
|
$db = new Db();
|
||||||
if ($sortorder == "") {
|
|
||||||
$sortorder="ASC";
|
|
||||||
}
|
|
||||||
if ($sortfield == "") {
|
|
||||||
$sortfield="nom";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'note') {
|
if ($action == 'note') {
|
||||||
$sql = "UPDATE societe SET note='$note' WHERE idp=$socid";
|
$sql = "UPDATE societe SET note='$note' WHERE idp=$socid";
|
||||||
@ -116,11 +110,21 @@ if ($socid > 0) {
|
|||||||
*/
|
*/
|
||||||
print_barre_liste("Liste des factures fournisseurs", $page, $PHP_SELF);
|
print_barre_liste("Liste des factures fournisseurs", $page, $PHP_SELF);
|
||||||
|
|
||||||
|
if ($sortorder == "")
|
||||||
|
{
|
||||||
|
$sortorder="ASC";
|
||||||
|
}
|
||||||
|
if ($sortfield == "")
|
||||||
|
{
|
||||||
|
$sortfield="fac.paye";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT s.idp as socid, s.nom, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, s.prefix_comm, fac.amount, fac.paye, fac.libelle, ".$db->pdate("fac.datef")." as datef, fac.rowid as facid";
|
$sql = "SELECT s.idp as socid, s.nom, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, s.prefix_comm, fac.amount, fac.paye, fac.libelle, ".$db->pdate("fac.datef")." as datef, fac.rowid as facid";
|
||||||
$sql .= " FROM societe as s, llx_facture_fourn as fac ";
|
$sql .= " FROM societe as s, llx_facture_fourn as fac ";
|
||||||
$sql .= " WHERE fac.fk_soc = s.idp";
|
$sql .= " WHERE fac.fk_soc = s.idp";
|
||||||
|
|
||||||
// $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
|
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
@ -128,17 +132,18 @@ if ($socid > 0) {
|
|||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ($sortorder == "DESC") {
|
if ($sortorder == "DESC")
|
||||||
$sortorder="ASC";
|
{
|
||||||
} else {
|
$sortorder="ASC";
|
||||||
$sortorder="DESC";
|
} else {
|
||||||
}
|
$sortorder="DESC";
|
||||||
|
}
|
||||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||||
print '<TR class="liste_titre">';
|
print '<TR class="liste_titre">';
|
||||||
print "<TD>Libelle</TD><td>";
|
print "<TD>Libelle</TD><td>";
|
||||||
print_liste_field_titre("Société",$PHP_SELF,"s.nom");
|
print_liste_field_titre("Société",$PHP_SELF,"s.nom");
|
||||||
print "</td><TD>Montant</TD>";
|
print '</td><TD align="right">Montant</TD>';
|
||||||
print "<td colspan=\"2\"> </td>";
|
print '<td align="center">Payé</td>';
|
||||||
print "</TR>\n";
|
print "</TR>\n";
|
||||||
$var=True;
|
$var=True;
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
@ -151,7 +156,7 @@ if ($socid > 0) {
|
|||||||
print "<TD><a href=\"../fiche.php3?socid=$obj->socid\">$obj->nom</A></td>\n";
|
print "<TD><a href=\"../fiche.php3?socid=$obj->socid\">$obj->nom</A></td>\n";
|
||||||
print '<TD align="right">'.price($obj->amount).'</TD>';
|
print '<TD align="right">'.price($obj->amount).'</TD>';
|
||||||
|
|
||||||
print "<TD align=\"center\">$obj->prefix_comm </TD>\n";
|
print '<TD align="center">'.$yn[$obj->paye].'</TD>';
|
||||||
|
|
||||||
|
|
||||||
print "</TR>\n";
|
print "</TR>\n";
|
||||||
|
|||||||
@ -71,26 +71,27 @@ class Societe {
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function update($id) {
|
Function update($id)
|
||||||
|
{
|
||||||
|
|
||||||
$sql = "UPDATE societe ";
|
$sql = "UPDATE societe ";
|
||||||
$sql .= " SET nom = '" . trim($this->nom) ."'";
|
$sql .= " SET nom = '" . trim($this->nom) ."'";
|
||||||
$sql .= ",address = '" . trim($this->adresse) ."'";
|
$sql .= ",address = '" . trim($this->adresse) ."'";
|
||||||
$sql .= ",cp = '" . trim($this->cp) ."'";
|
$sql .= ",cp = '" . trim($this->cp) ."'";
|
||||||
$sql .= ",ville = '" . trim($this->ville) ."'";
|
$sql .= ",ville = '" . trim($this->ville) ."'";
|
||||||
$sql .= ",tel = '" . trim($this->tel) ."'";
|
$sql .= ",tel = '" . trim($this->tel) ."'";
|
||||||
$sql .= ",fax = '" . trim($this->fax) ."'";
|
$sql .= ",fax = '" . trim($this->fax) ."'";
|
||||||
$sql .= ",url = '" . trim($this->url) ."'";
|
$sql .= ",url = '" . trim($this->url) ."'";
|
||||||
$sql .= ",siren = '" . trim($this->siren) ."'";
|
$sql .= ",siren = '" . trim($this->siren) ."'";
|
||||||
$sql .= ",client = " . $this->client ;
|
$sql .= ",client = " . $this->client ;
|
||||||
$sql .= ",fournisseur = " . $this->fournisseur ;
|
$sql .= ",fournisseur = " . $this->fournisseur ;
|
||||||
$sql .= " WHERE idp = " . $id .";";
|
$sql .= " WHERE idp = " . $id .";";
|
||||||
|
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
print $this->db->error();
|
print $this->db->error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -214,7 +215,69 @@ class Societe {
|
|||||||
$this->db->free();
|
$this->db->free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Function contact_email_array()
|
||||||
|
{
|
||||||
|
$contact_email = array();
|
||||||
|
|
||||||
|
$sql = "SELECT idp, email, name, firstname FROM socpeople WHERE fk_soc = $this->id";
|
||||||
|
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
$nump = $this->db->num_rows();
|
||||||
|
|
||||||
|
if ($nump)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $nump)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($i);
|
||||||
|
|
||||||
|
$contact_email[$obj->idp] = "$obj->firstname $obj->name <$obj->email>";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $contact_email;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Function contact_get_email($rowid)
|
||||||
|
{
|
||||||
|
|
||||||
|
$sql = "SELECT idp, email, name, firstname FROM socpeople WHERE idp = $rowid";
|
||||||
|
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
$nump = $this->db->num_rows();
|
||||||
|
|
||||||
|
if ($nump)
|
||||||
|
{
|
||||||
|
|
||||||
|
$obj = $this->db->fetch_object(0);
|
||||||
|
|
||||||
|
$contact_email = "$obj->firstname $obj->name <$obj->email>";
|
||||||
|
|
||||||
|
}
|
||||||
|
return $contact_email;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error();
|
||||||
|
print "<p>$rowid";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user