From 87a80ff31c3a9617be06365ae11039205d8d95d2 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sun, 13 Apr 2003 14:47:33 +0000 Subject: [PATCH] =?UTF-8?q?Nouvelle=20g=E9n=E9ration=20de=20facture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/facture.php3 | 44 +++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 20 deletions(-) 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 ''; print ""; - print ''; + print ''; + print ''; print ''; print ''; print "\n"; @@ -421,6 +435,7 @@ else $var=!$var; print ""; print "\n"; + print ''; print ''; print '\n"; if ($obj->statut == 0) @@ -526,13 +541,18 @@ else { print ""; } - else + elseif ($obj->statut == 1 && $obj->paye == 0) { print ""; } + else + { + print ""; + } print "
DescriptionDescriptionTva TxQuantitéMontant  
".stripslashes(nl2br($objp->description))."'.$objp->tva_taux.' %'.$objp->qty.''.price($objp->price)."[Valider]Générer la facture-
"; } print "

\n"; + /* * Documents générés * @@ -618,22 +638,6 @@ else print ""; 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 "

"; - } /* * *