pre release

This commit is contained in:
Rodolphe Quiedeville 2003-06-20 14:29:44 +00:00
parent 470d27103f
commit 7dec4f4959
5 changed files with 175 additions and 155 deletions

View File

@ -49,71 +49,39 @@ print_titre("Nouvelle proposition commerciale");
* Creation d'une nouvelle propale * Creation d'une nouvelle propale
* *
*/ */
if ($action == 'create') { if ($action == 'create')
if ( $objsoc->prefix_comm ) { {
if ( $objsoc->prefix_comm )
{
$numpr = "PR-" . $objsoc->prefix_comm . "-" . strftime("%y%m%d", time()); $numpr = "PR-" . $objsoc->prefix_comm . "-" . strftime("%y%m%d", time());
$sql = "SELECT count(*) FROM llx_propal WHERE ref like '$numpr%'"; $sql = "SELECT count(*) FROM llx_propal WHERE ref like '$numpr%'";
if ( $db->query($sql) ) { if ( $db->query($sql) )
$num = $db->result(0, 0); {
$db->free(); $num = $db->result(0, 0);
if ($num > 0) { $db->free();
$numpr .= "." . ($num + 1); if ($num > 0)
} {
} $numpr .= "." . ($num + 1);
}
}
print "<form action=\"propal.php3?socidp=$socidp\" method=\"post\">"; print "<form action=\"propal.php3?socidp=$socidp\" method=\"post\">";
print "<input type=\"hidden\" name=\"action\" value=\"add\">"; print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print '<table border="1" cellspacing="0" cellpadding="3" width="100%"><tr><td width="50%" valign="top">'; print '<table border="1" cellspacing="0" cellpadding="3" width="100%">';
$strmonth[1] = "Janvier"; print '<tr><td>Société</td><td><a href="fiche.php3?socid='.$socidp.'">'.$objsoc->nom.'</a></td>';
$strmonth[2] = "F&eacute;vrier";
$strmonth[3] = "Mars"; print '<td rowspan="6" valign="top">';
$strmonth[4] = "Avril"; print "Commentaires :<br>";
$strmonth[5] = "Mai"; print '<textarea name="note" wrap="soft" cols="30" rows="10"></textarea>';
$strmonth[6] = "Juin";
$strmonth[7] = "Juillet";
$strmonth[8] = "Ao&ucirc;t";
$strmonth[9] = "Septembre";
$strmonth[10] = "Octobre";
$strmonth[11] = "Novembre";
$strmonth[12] = "D&eacute;cembre";
$smonth = 1;
$syear = date("Y", time());
print '<table border="0">';
print '<tr><td>Société</td><td><a href="fiche.php3?socid='.$socidp.'">'.$objsoc->nom.'</a></td></tr>';
print "<tr><td>Date</td><td>"; print "<tr><td>Date</td><td>";
$cday = date("d", time()); print_date_select();
print "<select name=\"pday\">"; print "</td></tr>";
for ($day = 1 ; $day < $sday + 32 ; $day++) {
if ($day == $cday) {
print "<option value=\"$day\" SELECTED>$day";
} else {
print "<option value=\"$day\">$day";
}
}
print "</select>";
$cmonth = date("n", time());
print "<select name=\"pmonth\">";
for ($month = $smonth ; $month < $smonth + 12 ; $month++) {
if ($month == $cmonth) {
print "<option value=\"$month\" SELECTED>" . $strmonth[$month];
} else {
print "<option value=\"$month\">" . $strmonth[$month];
}
}
print "</select>";
print "<select name=\"pyear\">";
for ($year = $syear ; $year < $syear + 5 ; $year++) {
print "<option value=\"$year\">$year";
}
print "</select></td></tr>";
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";
@ -125,27 +93,34 @@ if ($action == 'create') {
print "<tr><td>Contact</td><td><select name=\"contactidp\">\n"; print "<tr><td>Contact</td><td><select name=\"contactidp\">\n";
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email FROM llx_socpeople as p WHERE p.fk_soc = $socidp"; $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email FROM llx_socpeople as p WHERE p.fk_soc = $socidp";
if ( $db->query($sql) ) { if ( $db->query($sql) )
$i = 0 ; {
$numdest = $db->num_rows(); $i = 0 ;
while ($i < $numdest) { $numdest = $db->num_rows();
$contact = $db->fetch_object( $i); while ($i < $numdest)
print '<option value="'.$contact->idp.'"'; {
if ($contact->idp == $setcontact) { $contact = $db->fetch_object( $i);
print ' SELECTED'; print '<option value="'.$contact->idp.'"';
} if ($contact->idp == $setcontact)
print '>'.$contact->firstname.' '.$contact->name.' ['.$contact->email.']</option>'; {
$i++; print ' SELECTED';
}
print '>'.$contact->firstname.' '.$contact->name.' ['.$contact->email.']</option>';
$i++;
}
$db->free();
}
else
{
print $db->error();
} }
$db->free();
} else {
print $db->error();
}
print '</select>'; print '</select>';
if ($numdest==0) {
print 'Cette societe n\'a pas de contact, veuillez en creer un avant de faire de propale</b><br>'; if ($numdest==0)
print '<a href=people.php3?socid='.$socidp.'&action=addcontact>Ajouter un contact</a>'; {
} print 'Cette societe n\'a pas de contact, veuillez en creer un avant de faire de propale</b><br>';
print '<a href=people.php3?socid='.$socidp.'&action=addcontact>Ajouter un contact</a>';
}
print '</td></tr>'; print '</td></tr>';
/* /*
* *
@ -176,31 +151,39 @@ if ($action == 'create') {
} }
print '</td></tr>'; print '</td></tr>';
print "</table>"; print "</table>";
/* /*
* *
* Liste des elements * Liste des elements
* *
*/ */
$sql = "SELECT p.rowid,p.label,p.ref,p.price FROM llx_product as p ORDER BY p.ref"; $sql = "SELECT p.rowid,p.label,p.ref,p.price FROM llx_product as p ORDER BY p.ref";
if ( $db->query($sql) ) { if ( $db->query($sql) )
$opt = "<option value=\"0\" SELECTED></option>"; {
if ($result) { $opt = "<option value=\"0\" SELECTED></option>";
$num = $db->num_rows(); $i = 0; if ($result)
while ($i < $num) { {
$objp = $db->fetch_object( $i); $num = $db->num_rows(); $i = 0;
$opt .= "<option value=\"$objp->rowid\">[$objp->ref] $objp->label : $objp->price</option>\n"; while ($i < $num)
$i++; {
} $objp = $db->fetch_object( $i);
$opt .= "<option value=\"$objp->rowid\">[$objp->ref] $objp->label : $objp->price</option>\n";
$i++;
}
}
$db->free();
} }
$db->free(); else
} else { {
print $db->error(); print $db->error();
} }
print_titre("Services/Produits");
print "<table border=1 cellspacing=0>"; print "<table border=1 cellspacing=0>";
print "<tr><td colspan=\"2\">Service/Produits</td></tr>\n";
print "<tr><td><select name=\"idprod1\">$opt</select></td>"; print "<tr><td><select name=\"idprod1\">$opt</select></td>";
print "<td><input type=\"text\" size=\"2\" name=\"qty1\" value=\"1\"></td></tr>\n"; print "<td><input type=\"text\" size=\"2\" name=\"qty1\" value=\"1\"></td></tr>\n";
@ -214,25 +197,22 @@ if ($action == 'create') {
print "<td><input type=\"text\" size=\"2\" name=\"qty4\" value=\"1\"></td></tr>\n"; 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";
print "</table>"; print "</table>";
/* /*
* Si il n'y a pas de contact pour la societe on ne permet pas la creation de propale * Si il n'y a pas de contact pour la societe on ne permet pas la creation de propale
*/ */
if ($numdest > 0) { if ($numdest > 0)
print "<input type=\"submit\" value=\"Enregistrer\">"; {
} print "<input type=\"submit\" value=\"Enregistrer\">";
print "</td><td valign=\"top\">"; }
print "Commentaires :<br>";
print "<textarea name=\"note\" wrap=\"soft\" cols=\"30\" rows=\"15\"></textarea>";
print "</td></tr></table>";
print "</form>"; print "</form>";
print "<hr noshade>";
} else {
print "Vous devez d'abord associer un prefixe commercial a cette societe" ;
} }
else
{
print "Vous devez d'abord associer un prefixe commercial a cette societe" ;
}
} }
/* /*

View File

@ -119,7 +119,7 @@ if ($result)
print "<TR $bc[$var]>"; print "<TR $bc[$var]>";
print "<TD>$obj->name</TD>"; print '<TD><a href="/comm/people.php3?contactid='.$obj->cidp.'&socid='.$obj->idp.'">'.$obj->name.'</a></TD>';
print "<TD>$obj->firstname</TD>"; print "<TD>$obj->firstname</TD>";
print '<TD><a href="contact.php3?socid='.$obj->idp.'"><img src="/theme/'.$conf->theme.'/img/filter.png" border="0" alt="filtrer"></a>&nbsp;'; print '<TD><a href="contact.php3?socid='.$obj->idp.'"><img src="/theme/'.$conf->theme.'/img/filter.png" border="0" alt="filtrer"></a>&nbsp;';

View File

@ -69,13 +69,12 @@ if ($action == 'update')
} }
} }
llxHeader(); /*
*
*
*/
if ($page == -1) { $page = 0 ; } llxHeader();
$limit = 26;
$offset = $limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
if ($socid > 0) if ($socid > 0)
{ {
@ -220,13 +219,23 @@ if ($socid > 0)
* *
* *
*/ */
if (defined("MAIN_MODULE_FICHEINTER") && MAIN_MODULE_FICHEINTER)
{
print "<p>";
print_titre("Fiche d'intervention");
}
/*
*
*
*/
print '<P><table width="100%" cellspacing="0" border="0" cellpadding="2">'; print '<P><table width="100%" cellspacing="0" border="0" cellpadding="2">';
print "<tr class=\"liste_titre\"><td>Action</td>"; print "<tr class=\"liste_titre\"><td>Action</td>";
print "<td>Fax</td><td>Email</td>"; print "<td>Fax</td><td>Email</td>";
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid ";
$sql .= " FROM actioncomm as a, c_actioncomm as c, llx_user as u "; $sql .= " FROM llx_actioncomm as a, c_actioncomm as c, llx_user as u ";
$sql .= " WHERE a.fk_soc = $objsoc->idp "; $sql .= " WHERE a.fk_soc = $objsoc->idp ";
$sql .= " AND u.rowid = a.fk_user_author"; $sql .= " AND u.rowid = a.fk_user_author";
$sql .= " AND c.id=a.fk_action "; $sql .= " AND c.id=a.fk_action ";

View File

@ -1,5 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* $Id$ * $Id$
* $Source$ * $Source$
@ -28,7 +28,8 @@ llxHeader("","../");
$db = new Db(); $db = new Db();
if ($action == 'create') { if ($action == 'create')
{
print_titre("Nouveau projet"); print_titre("Nouveau projet");
print '<form action="index.php3?socidp='.$socidp.'" method="post">'; print '<form action="index.php3?socidp='.$socidp.'" method="post">';
@ -66,53 +67,81 @@ if ($action == 'create') {
$projet = new Project($db); $projet = new Project($db);
$projet->fetch($id); $projet->fetch($id);
print '<table border=1 cellpadding="1" cellspacing="0">'; $projet->societe->fetch($projet->societe->id);
print '<tr><td>Société</td><td></td></tr>';
print '<tr><td>Ref</td><td>'.$projet->ref.'</td></tr>';
print '<tr><td>Titre</td><td>'.$projet->title.'</td></tr>';
print '</table>';
$propales = $projet->get_propal_list(); if ($action == 'edit')
{
if (sizeof($propales)>0 && is_array($propales)) {
print '<table border="1" cellpadding="4" cellspacing="0">';
print '<p>Listes des propales associées au projet'; print '<tr><td>Société</td><td>'.$projet->societe->nom.'</td></tr>';
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
print "<TR bgcolor=\"#e0e0e0\">";
print "<TD>Réf</TD>";
print '<TD>Date</TD>';
print '<TD align="right">Prix</TD>';
print '<TD align="center">Statut</TD>';
print '</TR>';
for ($i = 0; $i<sizeof($propales);$i++){
$propale = new Propal($db);
$propale->fetch($propales[$i]);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"../propal.php3?propalid=$propale->id\">$propale->ref</a></TD>\n";
print '<TD>'.strftime("%d %B %Y",$propale->datep).'</a></TD>';
print '<TD align="right">'.price($propale->price).'</TD>'; print '<tr><td>Ref</td><td>'.$projet->ref.'</td></tr>';
print '<TD align="center">statut</TD>'; print '<tr><td>Titre</td><td>'.$projet->title.'</td></tr>';
print '</TR>'; print '</table>';
$total = $total + $propale->price; }
else
{
print '<table border="1" cellpadding="4" cellspacing="0">';
print '<tr><td>Société</td><td>'.$projet->societe->nom.'</td></tr>';
print '<tr><td>Ref</td><td>'.$projet->ref.'</td></tr>';
print '<tr><td>Titre</td><td>'.$projet->title.'</td></tr>';
print '</table>';
$propales = $projet->get_propal_list();
if (sizeof($propales)>0 && is_array($propales)) {
print '<p>Listes des propales associées au projet';
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
print "<TR bgcolor=\"#e0e0e0\">";
print "<TD>Réf</TD>";
print '<TD>Date</TD>';
print '<TD align="right">Prix</TD>';
print '<TD align="center">Statut</TD>';
print '</TR>';
for ($i = 0; $i<sizeof($propales);$i++){
$propale = new Propal($db);
$propale->fetch($propales[$i]);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"../propal.php3?propalid=$propale->id\">$propale->ref</a></TD>\n";
print '<TD>'.strftime("%d %B %Y",$propale->datep).'</a></TD>';
print '<TD align="right">'.price($propale->price).'</TD>';
print '<TD align="center">statut</TD>';
print '</TR>';
$total = $total + $propale->price;
}
print '<tr><td>'.$i.' propales</td>';
print '<td colspan="2" align="right"><b>Total : '.price($total).'</b></td>';
print '<td align="left"><b>Euros HT</b></td></tr>';
print "</TABLE>";
} else {
print "pas de propales";
}
} }
print '<tr><td>'.$i.' propales</td>';
print '<td colspan="2" align="right"><b>Total : '.price($total).'</b></td>';
print '<td align="left"><b>Euros HT</b></td></tr>';
print "</TABLE>";
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
} else {
print "pas de propales"; print "<td align=\"center\" width=\"25%\"><a href=\"fiche.php3?id=$id&action=edit\">Editer</a></td>";
}
print "<td align=\"center\" width=\"25%\">-</td>";
print "<td align=\"center\" width=\"25%\">-</td>";
print "<td align=\"center\" width=\"25%\">-</td>";
print "</tr></table>";
} }

View File

@ -27,9 +27,11 @@ class Project {
var $ref; var $ref;
var $title; var $title;
var $socidp; var $socidp;
var $societe;
Function Project($DB) { Function Project($DB) {
$this->db = $DB; $this->db = $DB;
$this->societe = new Societe($DB);
} }
/* /*
* *
@ -58,7 +60,7 @@ class Project {
Function fetch($rowid) { Function fetch($rowid) {
$sql = "SELECT title, ref FROM llx_projet WHERE rowid=$rowid;"; $sql = "SELECT fk_soc, title, ref FROM llx_projet WHERE rowid=$rowid;";
if ($this->db->query($sql) ) { if ($this->db->query($sql) ) {
if ($this->db->num_rows()) { if ($this->db->num_rows()) {
@ -67,7 +69,7 @@ class Project {
$this->id = $rowid; $this->id = $rowid;
$this->ref = $obj->ref; $this->ref = $obj->ref;
$this->title = $obj->title; $this->title = $obj->title;
$this->societe->id = $obj->fk_soc;
$this->db->free(); $this->db->free();
} }
} else { } else {