diff --git a/htdocs/product/fiche.php3 b/htdocs/product/fiche.php3 index a6c4b993516..a14f2d7d014 100644 --- a/htdocs/product/fiche.php3 +++ b/htdocs/product/fiche.php3 @@ -22,6 +22,7 @@ require("./pre.inc.php3"); require("../propal.class.php3"); +require("../facture.class.php3"); llxHeader(); @@ -54,6 +55,21 @@ if ($action == 'addinpropal') $mesg .= ''.$propal->ref.''; } +if ($action == 'addinfacture') +{ + $product = new Product($db); + $result = $product->fetch($id); + + $facture = New Facture($db); + + $facture->fetch($HTTP_POST_VARS["factureid"]); + $facture->addline($HTTP_POST_VARS["factureid"], $product->description, $product->price, $HTTP_POST_VARS["qty"], $product->tva_tx, $id); + + $action = ''; + $mesg = 'Produit ajouté ŕ la facture '; + $mesg .= ''.$facture->ref.''; +} + if ($action == 'update' && $cancel <> 'Annuler') { $product = new Product($db); @@ -223,6 +239,7 @@ if ($id && $action == '' && $product->envente) $propal = New Propal($db); print ''; + print '"; print '
'; print_titre("Ajouter ma proposition"); print ''; @@ -239,9 +256,7 @@ if ($id && $action == '' && $product->envente) $num = $db->num_rows(); $i = 0; print ''; - - $var=True; - + $var=True; while ($i < $num) { $objp = $db->fetch_object( $i); @@ -249,29 +264,18 @@ if ($id && $action == '' && $product->envente) $var=!$var; print ""; print "\n"; - print "\n"; - - print "\n"; - + print "\n"; + print "\n"; print ''; print ''; - - print ""; - print ''; - - - print "\n"; - + print ''; $i++; - } - + } print "
propalid\">$objp->refidp\">$objp->nom"; - - print strftime("%d %B %Y",$objp->dp)."idp\">$objp->nom". strftime("%d %B %Y",$objp->dp)."
"; - print ''; + print ''; print ''; print ''; print ''; print "
"; $db->free(); } @@ -293,7 +297,54 @@ if ($id && $action == '' && $product->envente) print "
'; } + print ''; + + print ''; + print_titre("Ajouter ma facture"); + print ''; + print_titre("Ajouter aux autres factures"); + print ''; + print ''; + $sql = "SELECT s.nom, s.idp, f.rowid as factureid, f.facnumber,".$db->pdate("f.datef")." as df"; + $sql .= " FROM llx_societe as s, llx_facture as f"; + $sql .=" WHERE f.fk_soc = s.idp AND f.fk_statut = 0 AND f.fk_user_author = ".$user->id; + $sql .= " ORDER BY f.datec DESC, f.rowid DESC"; + + if ( $db->query($sql) ) + { + $num = $db->num_rows(); + $i = 0; + print ''; + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print ''; + print ''; + print '"; + print ''; + $i++; + } + print "
factureid\">$objp->facnumberidp\">$objp->nom". strftime("%d %B %Y",$objp->df)."
'; + print ''; + print ''; + print ''; + print "
"; + $db->free(); + } + else + { + print $db->error() . "
" . $sql; + } + print ''; print ''; + }