gestion des differents modeles pdf

This commit is contained in:
Rodolphe Quiedeville 2003-07-07 16:28:55 +00:00
parent 2fc8f8243e
commit f98db0fc50
3 changed files with 37 additions and 31 deletions

View File

@ -21,7 +21,7 @@
*/ */
require("./pre.inc.php3"); require("./pre.inc.php3");
require("./propal.class.php3"); require("./propal_model_pdf.class.php3");
$db = new Db(); $db = new Db();
@ -75,14 +75,16 @@ if ($action == 'create')
print '<tr><td>Société</td><td><a href="fiche.php3?socid='.$socidp.'">'.$objsoc->nom.'</a></td>'; print '<tr><td>Société</td><td><a href="fiche.php3?socid='.$socidp.'">'.$objsoc->nom.'</a></td>';
print '<td rowspan="6" valign="top">'; print '<td valign="top" colspan="2">';
print "Commentaires :<br>"; print "Commentaires</td></tr>";
print '<textarea name="note" wrap="soft" cols="30" rows="10"></textarea>';
print "<tr><td>Date</td><td>"; print "<tr><td>Date</td><td>";
print_date_select(); print_date_select();
print "</td></tr>"; print "</td>";
print '<td rowspan="4" colspan="2" valign="top">';
print '<textarea name="note" wrap="soft" cols="30" rows="10"></textarea>';
print '<tr><td>Auteur</td><td>'.$user->fullname.'</td></tr>'; print '<tr><td>Auteur</td><td>'.$user->fullname.'</td></tr>';
print "<tr><td>Num</td><td><input name=\"ref\" value=\"$numpr\"></td></tr>\n"; print "<tr><td>Num</td><td><input name=\"ref\" value=\"$numpr\"></td></tr>\n";
/* /*
@ -154,9 +156,13 @@ if ($action == 'create')
print 'Cette societe n\'a pas de projet.<br>'; print 'Cette societe n\'a pas de projet.<br>';
print '<a href=projet/fiche.php3?socidp='.$socidp.'&action=create>Créer un projet</a>'; print '<a href=projet/fiche.php3?socidp='.$socidp.'&action=create>Créer un projet</a>';
} }
print '</td></tr>'; print '</td>';
print '<td>Modèle</td>';
print "</table>"; print '<td>';
$html = new Form($db);
$modelpdf = new Propal_Model_pdf($db);
$html->select_array("modelpdf",$modelpdf->liste_array(),PROPALE_ADDON_PDF);
print "</td></tr></table>";
/* /*
* *
@ -187,19 +193,13 @@ if ($action == 'create')
print_titre("Services/Produits"); print_titre("Services/Produits");
print "<table border=1 cellspacing=0>"; print '<table border="1" cellspacing="0">';
print "<tr><td><select name=\"idprod1\">$opt</select></td>"; for ($i = 1 ; $i < 5 ; $i++)
print "<td><input type=\"text\" size=\"2\" name=\"qty1\" value=\"1\"></td></tr>\n"; {
print '<tr><td><select name="idprod'.$i.'">'.$opt.'</select></td>';
print "<tr><td><select name=\"idprod2\">$opt</select></td>"; print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td></tr>';
print "<td><input type=\"text\" size=\"2\" name=\"qty2\" value=\"1\"></td></tr>\n"; }
print "<tr><td><select name=\"idprod3\">$opt</select></td>";
print "<td><input type=\"text\" size=\"2\" name=\"qty3\" value=\"1\"></td></tr>\n";
print "<tr><td><select name=\"idprod4\">$opt</select></td>";
print "<td><input type=\"text\" size=\"2\" name=\"qty4\" value=\"1\"></td></tr>\n";
print "<tr><td align=\"right\" colspan=\"2\">Remise : <input size=\"6\" name=\"remise\" value=\"0\"></td></tr>\n"; print "<tr><td align=\"right\" colspan=\"2\">Remise : <input size=\"6\" name=\"remise\" value=\"0\"></td></tr>\n";

View File

@ -54,14 +54,17 @@ if ($action == 'add')
{ {
$propal = new Propal($db, $socidp); $propal = new Propal($db, $socidp);
$propal->remise = $remise; $propal->remise = $HTTP_POST_VARS["remise"];
$propal->datep = $db->idate(mktime(12, 1 , 1, $remonth, $reday, $reyear)); $propal->datep = $db->idate(mktime(12, 1 , 1,
$HTTP_POST_VARS["remonth"],
$propal->contactid = $contactidp; $HTTP_POST_VARS["reday"],
$propal->projetidp = $projetidp; $HTTP_POST_VARS["reyear"]));
$propal->contactid = $HTTP_POST_VARS["contactidp"];
$propal->projetidp = $HTTP_POST_VARS["projetidp"];
$propal->modelpdf = $HTTP_POST_VARS["modelpdf"];
$propal->author = $user->id; $propal->author = $user->id;
$propal->note = $note; $propal->note = $HTTP_POST_VARS["note"];
$propal->ref = $ref; $propal->ref = $ref;
@ -88,7 +91,9 @@ if ($action == 'add')
if ($action == 'pdf') if ($action == 'pdf')
{ {
propale_pdf_create($db, $propalid); $propal = new Propal($db);
$propal->fetch($propalid);
propale_pdf_create($db, $propalid, $propal->modelpdf);
} }
if ($action == 'setstatut') if ($action == 'setstatut')

View File

@ -132,8 +132,8 @@ class Propal
/* /*
* Insertion dans la base * Insertion dans la base
*/ */
$sql = "INSERT INTO llx_propal (fk_soc, fk_soc_contact, price, remise, tva, total, datep, datec, ref, fk_user_author, note) "; $sql = "INSERT INTO llx_propal (fk_soc, fk_soc_contact, price, remise, tva, total, datep, datec, ref, fk_user_author, note, model_pdf) ";
$sql .= " VALUES ($this->socidp, $this->contactid, 0, $this->remise, 0,0, $this->datep, now(), '$this->ref', $this->author, '$this->note')"; $sql .= " VALUES ($this->socidp, $this->contactid, 0, $this->remise, 0,0, $this->datep, now(), '$this->ref', $this->author, '$this->note','$this->modelpdf')";
$sqlok = 0; $sqlok = 0;
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )
@ -256,7 +256,7 @@ class Propal
Function fetch($rowid) Function fetch($rowid)
{ {
$sql = "SELECT ref,total,price,remise,tva,fk_soc,".$this->db->pdate(datep)."as dp "; $sql = "SELECT ref,total,price,remise,tva,fk_soc,".$this->db->pdate(datep)."as dp, model_pdf ";
$sql .= " FROM llx_propal WHERE rowid=$rowid;"; $sql .= " FROM llx_propal WHERE rowid=$rowid;";
if ($this->db->query($sql) ) if ($this->db->query($sql) )
@ -275,7 +275,8 @@ class Propal
$this->total_ht = $obj->price; $this->total_ht = $obj->price;
$this->total_tva = $obj->tva; $this->total_tva = $obj->tva;
$this->total_ttc = $obj->total; $this->total_ttc = $obj->total;
$this->socidp = $obj->fk_soc; $this->socidp = $obj->fk_soc;
$this->modelpdf = $obj->model_pdf;
$this->lignes = array(); $this->lignes = array();
$this->db->free(); $this->db->free();