diff --git a/htdocs/compta/facture.php3 b/htdocs/compta/facture.php3 index bab28856f35..b3e63357261 100644 --- a/htdocs/compta/facture.php3 +++ b/htdocs/compta/facture.php3 @@ -23,6 +23,7 @@ require("./pre.inc.php3"); require("../facture.class.php3"); require("../lib/CMailFile.class.php3"); require("../paiement.class.php"); +require("../project.class.php3"); require("./bank/account.class.php"); llxHeader(); @@ -120,7 +121,7 @@ if ($action == 'add') $facture = new Facture($db, $socid); $facture->number = $facnumber; $facture->date = $datefacture; - + $facture->projetid = $HTTP_POST_VARS["projetid"]; $facture->note = $note; $facture->amount = $amount; $facture->remise = $remise; @@ -232,8 +233,8 @@ if ($action == 'create') if ($propalid) { $sql = "SELECT s.nom, s.prefix_comm, s.idp, p.price, p.remise, p.tva, p.total, p.ref, ".$db->pdate("p.datep")." as dp, c.id as statut, c.label as lst"; - $sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; - + $sql .= " FROM societe as s, llx_propal as p, c_propalst as c"; + $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; $sql .= " AND p.rowid = $propalid"; } else @@ -257,10 +258,26 @@ if ($action == 'create') print ''; - print ""; + print ""; + print ""; + print ""; + print ""; + print ''; + print ''; + + print ""; + print ""; + + print ""; if ($propalid) { @@ -272,24 +289,11 @@ if ($action == 'create') print ''; print ""; - print ''; - print ""; - print ""; + print ''; + print ""; + print ""; } - else - { - } - - print ""; - print ""; - - print ""; - print ""; print ''; print "\n"; @@ -373,7 +377,7 @@ else print ''; print ""; - print ""; + print ""; print "
Client :$obj->nom
Client :$obj->nomCommentaire
Auteur :".$user->fullname."'; - print '
Date :"; + + print_date_select(time()); + + print "
Numéro :
Projet :"; + $proj = new Project($db); + $html->select_array("projetid",$proj->liste_array($socidp)); + print "
Propal :$obj->ref
Montant HT :'.price($amount).'
TVA 19.6% :".price($obj->tva)."
Total TTC :".price($obj->total)."
Montant HT :'.price($amount).'
TVA 19.6% :".price($obj->tva)."
Total TTC :".price($obj->total)."
Auteur :".$user->fullname."
Date :"; - - print_date_select(time()); - - print "
Numéro :
Statut'.$obj->statut.'Payé".$yn[$obj->paye]."
".$yn[$obj->paye]."
"; print ""; diff --git a/htdocs/facture.class.php3 b/htdocs/facture.class.php3 index 4e76ddd000e..26f97469062 100644 --- a/htdocs/facture.class.php3 +++ b/htdocs/facture.class.php3 @@ -41,7 +41,7 @@ class Facture { var $note; var $db_table; var $propalid; - + var $projetid; /* * Initialisation * @@ -82,8 +82,8 @@ class Facture { $tva = tva($totalht); $total = $totalht + $tva; - $sql = "INSERT INTO $this->db_table (facnumber, fk_soc, datec, amount, remise, tva, total, datef, note, fk_user_author) "; - $sql .= " VALUES ('$number', $socid, now(), $totalht, $remise, $tva, $total, $this->date,'$note',$userid);"; + $sql = "INSERT INTO $this->db_table (facnumber, fk_soc, datec, amount, remise, tva, total, datef, note, fk_user_author,fk_projet) "; + $sql .= " VALUES ('$number', $socid, now(), $totalht, $remise, $tva, $total, $this->date,'$note',$userid, $this->projetid);"; if ( $this->db->query($sql) ) { @@ -107,7 +107,8 @@ class Facture { Function fetch($rowid) { - $sql = "SELECT fk_soc,facnumber,amount,tva,total,remise,".$this->db->pdate(datef)."as df FROM llx_facture WHERE rowid=$rowid;"; + $sql = "SELECT fk_soc,facnumber,amount,tva,total,remise,".$this->db->pdate(datef)."as df,fk_projet"; + $sql .= " FROM llx_facture WHERE rowid=$rowid;"; if ($this->db->query($sql) ) { @@ -124,6 +125,7 @@ class Facture { $this->total_ttc = $obj->total; $this->remise = $obj->remise; $this->socidp = $obj->fk_soc; + $this->projetid = $obj->fk_projet; $this->lignes = array(); $this->db->free();