diff --git a/htdocs/compta/facture.php3 b/htdocs/compta/facture.php3 index 6184f5fb99f..86da9e13dd2 100644 --- a/htdocs/compta/facture.php3 +++ b/htdocs/compta/facture.php3 @@ -45,6 +45,10 @@ if ($action == 'valid') { $fac = new Facture($db); $result = $fac->set_valid($facid, $user->id); + if ($result) + { + facture_pdf_create($db, $facid); + } } if ($action == 'payed') @@ -79,7 +83,6 @@ if ($action == 'delete') $facid = 0 ; } - if ($action == 'add') { $datefacture = $db->idate(mktime(12, 0 , 0, $remonth, $reday, $reyear)); @@ -173,6 +176,16 @@ if ($action == 'send') } } +if ($action == 'pdf') +{ + /* + * Generation de la facture + * + */ + print facture_pdf_create($db, $facid); // définit dans /includes/modules/facture/modules_facture.php +} + + /* * * Mode creation @@ -398,7 +411,7 @@ else * */ - $sql = "SELECT l.description, l.price, l.qty, l.rowid"; + $sql = "SELECT l.description, l.price, l.qty, l.rowid, l.tva_taux"; $sql .= " FROM llx_facturedet as l WHERE l.fk_facture = $facid"; $result = $db->query($sql); @@ -409,7 +422,8 @@ else echo '
| Description | '; + print 'Description | '; + print 'Tva Tx | '; print 'Quantité | '; print 'Montant | '; print " | |
| ".stripslashes(nl2br($objp->description))." | \n"; + print ''.$objp->tva_taux.' % | '; print ''.$objp->qty.' | '; print ''.price($objp->price)." | \n"; if ($obj->statut == 0) @@ -526,13 +541,18 @@ else { print "[Valider] | "; } - else + elseif ($obj->statut == 1 && $obj->paye == 0) { print "Générer la facture | "; } + else + { + print "- | "; + } print "
\n"; + /* * Documents générés * @@ -618,22 +638,6 @@ else print ""; print ""; - /* - * Generation de la facture - * - */ - if ($action == 'pdf') - { - print "
"; - $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 "