From 07f0fd0a293c9f35b6176eb6c8668994894ef519 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sun, 23 Mar 2003 15:53:03 +0000 Subject: [PATCH] Ajout filtre acces client --- htdocs/comm/clients.php3 | 208 ++++++---- htdocs/compta/facture.php3 | 791 +++++++++++++++++++------------------ 2 files changed, 534 insertions(+), 465 deletions(-) diff --git a/htdocs/comm/clients.php3 b/htdocs/comm/clients.php3 index 7cbd0addc89..2d7656f08e5 100644 --- a/htdocs/comm/clients.php3 +++ b/htdocs/comm/clients.php3 @@ -1,8 +1,5 @@ - * - * $Id$ - * $Source$ +/* Copyright (C) 2001-2003 Rodolphe Quiedeville * * 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 @@ -18,6 +15,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * $Id$ + * $Source$ + * */ require("./pre.inc.php3"); require("../contact.class.php3"); @@ -27,6 +27,16 @@ require("../actioncomm.class.php3"); llxHeader(); +/* + * Sécurité accés client + */ +if ($user->societe_id > 0) +{ + $action = ''; + $socidp = $user->societe_id; +} + + $db = new Db(); if ($sortorder == "") { @@ -73,51 +83,55 @@ if ($action=='add_action') { } -if ($action == 'attribute_prefix') { +if ($action == 'attribute_prefix') +{ $societe = new Societe($db, $socid); $societe->attribute_prefix($db, $socid); } -if ($action == 'recontact') { +if ($action == 'recontact') +{ $dr = mktime(0, 0, 0, $remonth, $reday, $reyear); $sql = "INSERT INTO llx_soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')"; $result = $db->query($sql); } -if ($action == 'note') { +if ($action == 'note') +{ $sql = "UPDATE societe SET note='$note' WHERE idp=$socid"; $result = $db->query($sql); } -if ($action == 'stcomm') { - if ($stcommid <> 'null' && $stcommid <> $oldstcomm) { - $sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) "; - $sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $GLOBALS["REMOTE_USER"] . "')"; - $result = @$db->query($sql); - - if ($result) { - $sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid"; - $result = $db->query($sql); - } else { - $errmesg = "ERREUR DE DATE !"; +if ($action == 'stcomm') +{ + if ($stcommid <> 'null' && $stcommid <> $oldstcomm) + { + $sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) "; + $sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $GLOBALS["REMOTE_USER"] . "')"; + $result = @$db->query($sql); + + if ($result) + { + $sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid"; + $result = $db->query($sql); + } + else + { + $errmesg = "ERREUR DE DATE !"; + } } - } - if ($actioncommid) { - $sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')"; - $result = @$db->query($sql); - - if (!$result) { - $errmesg = "ERREUR DE DATE !"; + if ($actioncommid) + { + $sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')"; + $result = @$db->query($sql); + + if (!$result) + { + $errmesg = "ERREUR DE DATE !"; + } } - } } -if ($page == -1) { $page = 0 ; } - -$offset = $conf->liste_limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - /* * Recherche @@ -139,53 +153,73 @@ if ($mode == 'search') { } } +if ($page == -1) { $page = 0 ; } - /* - * Mode Liste - * - * - * - */ - print_barre_liste("Liste des clients", $page, $PHP_SELF); +$offset = $conf->liste_limit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; - $sql = "SELECT s.idp, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm FROM societe as s, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.client=1"; - if (strlen($stcomm)) { - $sql .= " AND s.fk_stcomm=$stcomm"; - } - if (strlen($begin)) { - $sql .= " AND upper(s.nom) like '$begin%'"; - } +/* + * Mode Liste + * + * + * + */ +print_barre_liste("Liste des clients", $page, $PHP_SELF); - if ($socname) { - $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'"; - $sortfield = "lower(s.nom)"; - $sortorder = "ASC"; - } +$sql = "SELECT s.idp, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm FROM societe as s, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.client=1"; - $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); +if (strlen($stcomm)) +{ + $sql .= " AND s.fk_stcomm=$stcomm"; +} - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows(); - $i = 0; +if (strlen($begin)) +{ + $sql .= " AND upper(s.nom) like '$begin%'"; +} - if ($sortorder == "DESC") { +if ($user->societe_id) +{ + $sql .= " AND s.idp = " .$user->societe_id; +} + +if ($socname) +{ + $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'"; + $sortfield = "lower(s.nom)"; + $sortorder = "ASC"; +} + +$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); + +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows(); + $i = 0; + + if ($sortorder == "DESC") + { $sortorder="ASC"; - } else { + } + else + { $sortorder="DESC"; } - print ""; - print ''; - print ""; - print ""; - print ""; - print "\n"; - $var=True; - while ($i < $num) { + print "
"; - print_liste_field_titre("Société",$PHP_SELF,"s.nom"); - print "VilleemailStatut  
"; + print ''; + print ""; + print ""; + print "\n"; + $var=True; + + while ($i < $num) + { $obj = $db->fetch_object( $i); $var=!$var; @@ -193,23 +227,35 @@ if ($mode == 'search') { print ""; print "\n"; print "\n"; - print "\n"; - print "\n"; print "\n"; - print "\n"; - if ($conf->fichinter->enabled) { - print "\n"; - } else { - print "\n"; - } + + if ($user->societe_id == 0) + { + print "\n"; + if ($conf->fichinter->enabled) + { + print "\n"; + } + else + { + print "\n"; + } + } + else + { + print "\n"; + print "\n"; + } print "\n"; $i++; } - print "
"; + print_liste_field_titre("Société",$PHP_SELF,"s.nom"); + print "VillePréfix 
idp\">$obj->nom".$obj->ville."  $obj->stcomm$obj->prefix_comm idp&action=create\">[Propal]idp&action=create\">[Fiche Inter] idp&action=create\">[Propal]idp&action=create\">[Fiche Inter]   
"; - $db->free(); - } else { - print $db->error() . ' ' . $sql; - } + print ""; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} $db->close(); diff --git a/htdocs/compta/facture.php3 b/htdocs/compta/facture.php3 index 44cb8a18044..6184f5fb99f 100644 --- a/htdocs/compta/facture.php3 +++ b/htdocs/compta/facture.php3 @@ -29,7 +29,18 @@ $db = new Db(); $yn[1] = "oui"; $yn[0] = "non"; - + +/* + * Sécurité accés client + */ +if ($user->societe_id > 0) +{ + $action = ''; + $socidp = $user->societe_id; +} +/* + * + */ if ($action == 'valid') { $fac = new Facture($db); @@ -75,7 +86,6 @@ if ($action == 'add') if (! $propalid) { - $facture = new Facture($db, $socid); $facture->number = $facnumber; $facture->date = $datefacture; @@ -89,7 +99,6 @@ if ($action == 'add') } else { - $facture = new Facture($db, $socid); $facture->number = $facnumber; @@ -107,8 +116,7 @@ if ($action == 'add') } } $facid = $facid; - $action = ''; - + $action = ''; } /* * @@ -172,7 +180,6 @@ if ($action == 'send') * * */ - if ($action == 'create') { print_titre("Emettre une facture"); @@ -271,6 +278,11 @@ else $sql = "SELECT s.nom as socnom, s.idp as socidp, f.facnumber, f.amount, f.total, ".$db->pdate("f.datef")." as df, f.paye, f.fk_statut as statut, f.fk_user_author, f.note"; $sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND f.rowid = $facid"; + if ($user->societe_id > 0) + { + $sql .= " AND s.idp = ".$user->societe_id; + } + $result = $db->query( $sql); if ($result) @@ -287,288 +299,119 @@ else print $db->error(); } - $soc = new Societe($db, $obj->socidp); + if ($num > 0) + { - $author = new User($db); - $author->id = $obj->fk_user_author; - $author->fetch(); + $soc = new Societe($db, $obj->socidp); - print_titre("Facture : ".$obj->facnumber); + $author = new User($db); + $author->id = $obj->fk_user_author; + $author->fetch(); + + print_titre("Facture : ".$obj->facnumber); - print ""; - print ""; - print "
"; - /* - * Facture - */ - print ""; - print ""; - print ""; - - print ""; - print "\n"; - print ""; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ""; - print ""; - print "
Client"; - print "socidp\">$obj->socnom
Date".strftime("%A %d %B %Y",$obj->df)."
".translate("Author")."$author->fullname
Montant'.price($obj->amount).'euros HT
TVA'.tva($obj->amount).'euros
Total'.price($obj->total).'euros TTC
Statut'.$obj->statut.'".translate("Payed")."".$yn[$obj->paye]."
"; - - print "
"; - - $_MONNAIE="euros"; - - /* - * Paiements - */ - $sql = "SELECT ".$db->pdate("datep")." as dp, p.amount, c.libelle as paiement_type, p.num_paiement, p.rowid"; - $sql .= " FROM llx_paiement as p, c_paiement as c WHERE p.fk_facture = $facid AND p.fk_paiement = c.id"; - - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows(); - $i = 0; $total = 0; - print "

Paiements"; - echo ''; - print ""; - print ""; - print ""; - print ""; - print "\n"; - - $var=True; - while ($i < $num) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - print ""; - $total = $total + $objp->amount; - $i++; - } - - if ($obj->paye == 0) { - print "\n"; - print "\n"; + print "
DateTypeMontant 
".strftime("%d %B %Y",$objp->dp)."$objp->paiement_type $objp->num_paiement".price($objp->amount)."$_MONNAIE
Total :".price($total)."$_MONNAIE
Facturé :".price($obj->total)."$_MONNAIE
"; + print ""; - print ""; - print "
"; + /* + * Facture + */ + print ""; + print ""; + print ""; - $resteapayer = $obj->total - $total; - - print ""; - print "\n"; - } - print "
Client"; + print "socidp\">$obj->socnom
Reste a payer :".price($resteapayer)."$_MONNAIE
"; - $db->free(); - } else { - print $db->error(); - } - - print "
Note : ".nl2br($obj->note)."
"; - /* - * Lignes de factures - * - */ - - $sql = "SELECT l.description, l.price, l.qty, l.rowid"; - $sql .= " FROM llx_facturedet as l WHERE l.fk_facture = $facid"; - - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows(); - $i = 0; $total = 0; - - echo ''; - print ""; - print ''; - print ''; - print ''; - print "\n"; - - $var=True; - while ($i < $num) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print ''; - print '\n"; - if ($obj->statut == 0) - { - print ''; - print ''; - } - else - { - print ''; - } - print ""; - - if ($action == 'editline' && $rowid == $objp->rowid) - { - print ""; - print ''; - print ''; - print ""; - print ''; - print ''; - print ''; - print ''; - print '' . "\n"; - print "\n"; - } - - $total = $total + ($objp->qty * $objp->price); - $i++; - } + print ""; + print "\n"; + print ""; - $db->free(); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ""; + print ""; print "
DescriptionQuantitéMontant  
".stripslashes(nl2br($objp->description))."'.$objp->qty.''.price($objp->price)."deledit  
Date".strftime("%A %d %B %Y",$obj->df)."
".translate("Author")."$author->fullname
Montant'.price($obj->amount).'euros HT
TVA'.tva($obj->amount).'euros
Total'.price($obj->total).'euros TTC
Statut'.$obj->statut.'".translate("Payed")."".$yn[$obj->paye]."
"; - } - else - { - print $db->error(); - } + + print "

"; - /* - * Ajouter une ligne - * - */ - if ($obj->statut == 0) - { - print "
"; - echo ''; - print ""; - print ""; - print ""; - print ""; - print "\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "
DescriptionQuantitéMontant
"; - print "
"; - } + $_MONNAIE="euros"; - /* - * Fin Ajout ligne - * - */ - - print "

"; - - if ($obj->statut == 0) - { - print ""; - } - elseif ($obj->statut == 1 && $resteapayer > 0) - { - print ""; - } - else - { - print ""; - } - - if ($obj->statut == 1 && $resteapayer > 0) - { - print ""; - } - else - { - print ""; - } - - if ($obj->statut == 1 && abs($resteapayer == 0) && $obj->paye == 0) - { - print ""; - } - else - { - print ""; - } - - if ($obj->statut == 0) - { - print ""; - } - else - { - print ""; - } - print "
[Supprimer][Envoyer]-[Emettre un paiement]-[Classer 'Payée']-[Valider]Générer la facture

"; - - /* - * Documents générés - * - */ - print "


"; - print ""; - print '"; + print ""; + print "
"; - print_titre("Documents générés"); - print ''; - - $file = $conf->facture->outputdir . "/" . $obj->facnumber . "/" . $obj->facnumber . ".pdf"; - - - if (file_exists($file)) - { - print ""; - print ''; - print ''; - print ''; - print ''; - } - - $file = $conf->facture->outputdir . "/" . $obj->facnumber . "/" . $obj->facnumber . ".ps"; - - if (file_exists($file)) - { - print ""; - print ''; - print ''; - print ''; - print ''; - - - } - print ''; - - print "
Facture PDFfacnumber."/".$obj->facnumber.'.pdf">'.$obj->facnumber.'.pdf'.filesize($file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
Facture Postscriptfacnumber."/".$obj->facnumber.'.ps">'.$obj->facnumber.'.ps'.filesize($file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
(liste...)
\n"; - print "
'; - 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) + /* + * Paiements + */ + $sql = "SELECT ".$db->pdate("datep")." as dp, p.amount, c.libelle as paiement_type, p.num_paiement, p.rowid"; + $sql .= " FROM llx_paiement as p, c_paiement as c WHERE p.fk_facture = $facid AND p.fk_paiement = c.id"; + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows(); $i = 0; $total = 0; - print ''; - print ""; + print "

Paiements"; + echo '

'; + print ""; print ""; - print ""; + print ""; + print ""; + print "\n"; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print ""; + $total = $total + $objp->amount; + $i++; + } + + if ($obj->paye == 0) + { + print "\n"; + print "\n"; + + $resteapayer = $obj->total - $total; + + print ""; + print "\n"; + } + print "
DateActionTypeMontant 
".strftime("%d %B %Y",$objp->dp)."$objp->paiement_type $objp->num_paiement".price($objp->amount)."$_MONNAIE
Total :".price($total)."$_MONNAIE
Facturé :".price($obj->total)."$_MONNAIE
Reste a payer :".price($resteapayer)."$_MONNAIE
"; + $db->free(); + } else { + print $db->error(); + } + + print "
Note : ".nl2br($obj->note)."
"; + /* + * Lignes de factures + * + */ + + $sql = "SELECT l.description, l.price, l.qty, l.rowid"; + $sql .= " FROM llx_facturedet as l WHERE l.fk_facture = $facid"; + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows(); + $i = 0; $total = 0; + + echo ''; + print ""; + print ''; + print ''; + print ''; print "\n"; $var=True; @@ -577,125 +420,305 @@ else $objp = $db->fetch_object( $i); $var=!$var; print ""; - print "\n"; - print ''; + print "\n"; + print ''; + print '\n"; + if ($obj->statut == 0) + { + print ''; + print ''; + } + else + { + print ''; + } print ""; + + if ($action == 'editline' && $rowid == $objp->rowid) + { + print ""; + print ''; + print ''; + print ""; + print ''; + print ''; + print ''; + print ''; + print '' . "\n"; + print "\n"; + } + + $total = $total + ($objp->qty * $objp->price); $i++; } + + $db->free(); print "
DescriptionQuantitéMontant  
".strftime("%d %B %Y",$objp->da)."'.stripslashes($objp->note).'".stripslashes(nl2br($objp->description))."'.$objp->qty.''.price($objp->price)."deledit  
"; + } + else + { + print $db->error(); } + + /* + * Ajouter une ligne + * + */ + if ($obj->statut == 0) + { + print "
"; + echo ''; + print ""; + print ""; + print ""; + print ""; + print "\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "
DescriptionQuantitéMontant
"; + print "
"; + } + + /* + * Fin Ajout ligne + * + */ + if ($user->societe_id == 0) + { + print "

"; + + if ($obj->statut == 0) + { + print ""; + } + elseif ($obj->statut == 1 && $resteapayer > 0) + { + print ""; + } + else + { + print ""; + } + + if ($obj->statut == 1 && $resteapayer > 0) + { + print ""; + } + else + { + print ""; + } + + if ($obj->statut == 1 && abs($resteapayer == 0) && $obj->paye == 0) + { + print ""; + } + else + { + print ""; + } + + if ($obj->statut == 0) + { + print ""; + } + else + { + print ""; + } + print "
[Supprimer][Envoyer]-[Emettre un paiement]-[Classer 'Payée']-[Valider]Générer la facture
"; + } + print "

\n"; + /* + * Documents générés + * + */ + print "


"; + print ""; + print '"; + print "
"; + print_titre("Documents générés"); + print ''; + + $file = $conf->facture->outputdir . "/" . $obj->facnumber . "/" . $obj->facnumber . ".pdf"; + + + if (file_exists($file)) + { + print ""; + print ''; + print ''; + print ''; + print ''; + } + + $file = $conf->facture->outputdir . "/" . $obj->facnumber . "/" . $obj->facnumber . ".ps"; + + if (file_exists($file)) + { + print ""; + print ''; + print ''; + print ''; + print ''; + + + } + print ''; + + print "
Facture PDFfacnumber."/".$obj->facnumber.'.pdf">'.$obj->facnumber.'.pdf'.filesize($file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
Facture Postscriptfacnumber."/".$obj->facnumber.'.ps">'.$obj->facnumber.'.ps'.filesize($file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
(liste...)
\n"; + print "
'; + 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 ''; + print ""; + print ""; + print ""; + print "\n"; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print ''; + print ""; + $i++; + } + print "
DateAction
".strftime("%d %B %Y",$objp->da)."'.stripslashes($objp->note).'
"; + } + } + else + { + print $db->error(); + } + + /* + * + * + */ + print "
"; + + /* + * Generation de la facture + * + */ + if ($action == 'pdf') + { + print "
Génération de la facture
";
+	    $command = "export DBI_DSN=\"dbi:mysql:dbname=".$conf->db->name."\" ";
+	    $command .= " ; ./texfacture.pl --html -vv --facture=$facid --pdf --output=".$conf->facture->outputdir;
+	    $command .= " --templates=".$conf->facture->templatesdir;
+	    
+	    $output = system($command);
+	    print "

command :
$command
"; + //print "

output :
$output
"; + print "

"; + } + /* + * + * + */ + if ($action == 'presend') + { + $replytoname = "R. Quiedeville"; + $from_name = $replytoname; + $replytomail = "rq@quiedeville.org"; + $from_mail = $replytomail; + + print "
\n"; + print "\n"; + print "\n"; + + print "

Envoyer la facture par mail"; + print ""; + print ''; + print ""; + print ""; + print ""; + print ""; + + print "
Destinataire'; + + $form = new Form($db); + + $form->select_array("destinataire",$soc->contact_email_array()); + + print 'email\">
Expéditeur$from_name$from_mail
Reply-to$replytoname$replytomail
"; + print ""; + print "

"; + } + + /* + * Propales + */ + + $sql = "SELECT ".$db->pdate("p.datep")." as dp, p.price, p.ref, p.rowid as propalid"; + $sql .= " FROM llx_propal as p, llx_fa_pr as fp WHERE fp.fk_propal = p.rowid AND fp.fk_facture = $facid"; + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows(); + if ($num) + { + $i = 0; $total = 0; + print "

Proposition(s) commerciale(s) associée(s)"; + print ''; + print ""; + print ""; + print ""; + print ""; + print "\n"; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print ''; + print ""; + $total = $total + $objp->price; + $i++; + } + print "\n"; + print "
NumDatePrix
propalid\">$objp->ref".strftime("%d %B %Y",$objp->dp)."'.price($objp->price).'
Total : ".price($total)." $_MONNAIE HT
"; + } + } else { + print $db->error(); + } } else { - print $db->error(); + /* Facture non trouvée */ + print "Facture inexistante ou accés refusé"; } - - /* - * - * - */ - print "

"; - - /* - * Generation de la facture - * - */ - if ($action == 'pdf') - { - print "
Génération de la facture
";
-	$command = "export DBI_DSN=\"dbi:mysql:dbname=".$conf->db->name."\" ";
-	$command .= " ; ./texfacture.pl --html -vv --facture=$facid --pdf --output=".$conf->facture->outputdir;
-	$command .= " --templates=".$conf->facture->templatesdir;
-	
-	$output = system($command);
-	print "

command :
$command
"; - //print "

output :
$output
"; - print "

"; - } - /* - * - * - */ - if ($action == 'presend') - { - $replytoname = "R. Quiedeville"; - $from_name = $replytoname; - $replytomail = "rq@quiedeville.org"; - $from_mail = $replytomail; - - print "
\n"; - print "\n"; - print "\n"; - - print "

Envoyer la facture par mail"; - print ""; - print ''; - print ""; - print ""; - print ""; - print ""; - - print "
Destinataire'; - - $form = new Form($db); - - $form->select_array("destinataire",$soc->contact_email_array()); - - print 'email\">
Expéditeur$from_name$from_mail
Reply-to$replytoname$replytomail
"; - print ""; - print "

"; - } - - /* - * - * - */ - - - /* - * Propales - */ - - $sql = "SELECT ".$db->pdate("p.datep")." as dp, p.price, p.ref, p.rowid as propalid"; - $sql .= " FROM llx_propal as p, llx_fa_pr as fp WHERE fp.fk_propal = p.rowid AND fp.fk_facture = $facid"; - - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows(); - if ($num) { - $i = 0; $total = 0; - print "

Proposition(s) commerciale(s) associée(s)"; - print ''; - print ""; - print ""; - print ""; - print ""; - print "\n"; - - $var=True; - while ($i < $num) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print ''; - print ""; - $total = $total + $objp->price; - $i++; - } - print "\n"; - print "
NumDatePrix
propalid\">$objp->ref".strftime("%d %B %Y",$objp->dp)."'.price($objp->price).'
Total : ".price($total)." $_MONNAIE HT
"; - } - } else { - print $db->error(); - } - } else { /* * - * Liste + * Mode Liste * * */