/[dolibarr]/dolibarr/htdocs/product/stats/propal.php
ViewVC logotype

Diff of /dolibarr/htdocs/product/stats/propal.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by eldy, Fri Aug 19 20:46:33 2005 UTC revision 1.12 by eldy, Sun Sep 4 21:42:55 2005 UTC
# Line 18  Line 18 
18   *   *
19   * $Id$   * $Id$
20   * $Source$   * $Source$
  *  
21   */   */
22    
23  /**         \file       htdocs/product/stats/propal.php  /**
24          \ingroup    product, service              \file       htdocs/product/stats/propal.php
25            \ingroup    product, service, propal
26                  \brief      Page des stats des propals pour un produit                  \brief      Page des stats des propals pour un produit
27                  \version    $Revision$                  \version    $Revision$
28  */  */
29    
30    
31  require("./pre.inc.php");  require("./pre.inc.php");
32    include_once(DOL_DOCUMENT_ROOT."/propal.class.php");
33    
34  $mesg = '';  $mesg = '';
35    
36  $page = $_GET["page"];  $page = $_GET["page"];
37  $sortfield=$_GET["sortfield"];  $sortfield=$_GET["sortfield"];
38  $sortorder=$_GET["sortorder"];  $sortorder=$_GET["sortorder"];
39    if ($page == -1) { $page = 0 ; }
40    $offset = $conf->liste_limit * $_GET["page"] ;
41    $pageprev = $_GET["page"] - 1;
42    $pagenext = $_GET["page"] + 1;
43  if (! $sortorder) $sortorder="DESC";  if (! $sortorder) $sortorder="DESC";
44  if (! $sortfield) $sortfield="p.datec";  if (! $sortfield) $sortfield="p.datec";
45  if ($page == -1) $page = 0;  
 $limit = $conf->liste_limit;  
 $offset = $limit * $page ;  
46    
47  if ($user->societe_id > 0)  if ($user->societe_id > 0)
48  {  {
# Line 129  if ($_GET["id"]) Line 132  if ($_GET["id"])
132          $hselected=$h;          $hselected=$h;
133          $h++;          $h++;
134                    
135            $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$product->id;
136            $head[$h][1] = $langs->trans('Documents');
137            $h++;
138                    
139          dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);          dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
140    
141          print '<table class="border" width="100%"><tr>';  
142          print '<td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">'.$product->ref.'</td>';          print '<table class="border" width="100%">';
143    
144            print '<tr>';
145            print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">'.$product->ref.'</td>';
146          print '</tr>';          print '</tr>';
147          print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td></tr>';          print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td>';
148            print '</tr>';
149            
150            // Prix
151          print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="3">'.price($product->price).'</td></tr>';          print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="3">'.price($product->price).'</td></tr>';
152    
153          // Statut          // Statut
# Line 223  if ($_GET["id"]) Line 235  if ($_GET["id"])
235    
236          print '</div>';          print '</div>';
237    
         print_barre_liste($langs->trans("Proposals"),$page,"propal.php","&amp;id=$product->id",$sortfield,$sortorder);  
   
         $sql = "SELECT distinct(p.rowid), s.nom,s.idp, p.ref,".$db->pdate("p.datep")." as df,p.rowid as facid";  
         $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."propaldet as d WHERE p.fk_soc = s.idp";  
         $sql .= " AND d.fk_propal = p.rowid AND d.fk_product =".$product->id;  
238    
239            $sql = "SELECT distinct(s.nom), s.idp, p.rowid as propalid, p.ref, p.total as amount,";
240                    $sql.= $db->pdate("p.datec")." as date, p.fk_statut as statut";
241            $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."propaldet as d";
242                    $sql.= " WHERE p.fk_soc = s.idp";
243            $sql.= " AND d.fk_propal = p.rowid AND d.fk_product =".$product->id;
244          if ($socid)          if ($socid)
245          {          {
246              $sql .= " AND p.fk_soc = $socid";              $sql .= " AND p.fk_soc = $socid";
247          }          }
   
248          $sql .= " ORDER BY $sortfield $sortorder ";          $sql .= " ORDER BY $sortfield $sortorder ";
249          $sql .= $db->plimit( $limit ,$offset);          $sql.= $db->plimit($conf->liste_limit +1, $offset);
250    
251          $result = $db->query($sql);          $result = $db->query($sql);
252          if ($result)          if ($result)
253          {          {
254              $num = $db->num_rows($result);              $num = $db->num_rows($result);
255    
256                print_barre_liste($langs->trans("Proposals"),$page,$_SERVER["PHP_SELF"],"&amp;id=$product->id",$sortfield,$sortorder,'',$num);
257    
258              $i = 0;              $i = 0;
259              print "<table class=\"noborder\" width=\"100%\">";              print "<table class=\"noborder\" width=\"100%\">";
260              print '<tr class="liste_titre">';              print '<tr class="liste_titre">';
261              print_liste_field_titre($langs->trans("Ref"),"propal.php","p.rowid","","&amp;id=".$_GET["id"],'',$sortfield);              print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.rowid","","&amp;id=".$_GET["id"],'',$sortfield);
262              print_liste_field_titre($langs->trans("Company"),"propal.php","s.nom","","&amp;id=".$_GET["id"],'',$sortfield);              print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&amp;id=".$_GET["id"],'',$sortfield);
263              print_liste_field_titre($langs->trans("Date"),"propal.php","f.datef","","&amp;id=".$_GET["id"],'align="right"',$sortfield);              print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"p.datec","","&amp;id=".$_GET["id"],'align="center"',$sortfield);
264                print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"p.total","","&amp;id=".$_GET["id"],'align="right"',$sortfield);
265                print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.fk_statut","","&amp;id=".$_GET["id"],'align="center"',$sortfield);
266              print "</tr>\n";              print "</tr>\n";
267    
268              if ($num > 0)              if ($num > 0)
269              {              {
270                  $var=True;                  $var=True;
271                  while ($i < $num)                  while ($i < $num && $i < $conf->liste_limit)
272                  {                  {
273                      $objp = $db->fetch_object($result);                      $objp = $db->fetch_object($result);
274                      $var=!$var;                      $var=!$var;
275    
276                      print "<tr $bc[$var]>";                      print "<tr $bc[$var]>";
277                      print '<td><a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$objp->facid.'">';                      print '<td><a href="'.DOL_URL_ROOT.'/comm/propal.php?propalid='.$objp->propid.'">'.img_object($langs->trans("ShowPropal"),"propal").' ';
                     print img_object($langs->trans("ShowPropal"),"propal").' ';  
278                      print $objp->ref;                      print $objp->ref;
279                      print "</a></td>\n";                      print "</a></td>\n";
280                      print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$objp->nom.'</a></td>';                      print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,44).'</a></td>';
281                      print "<td align=\"right\">";                      print "<td align=\"center\">";
282                      print strftime("%d %B %Y",$objp->df)."</td>";                      print dolibarr_print_date($objp->date)."</td>";
283                        print "<td align=\"right\">".price($objp->amount)."</td>\n";
284                        $prop=new Propal($db);
285                        print '<td align="center">'.$prop->LibStatut($objp->statut,1).'</td>';
286                      print "</tr>\n";                      print "</tr>\n";
287                      $i++;                      $i++;
288                  }                  }
# Line 276  if ($_GET["id"]) Line 293  if ($_GET["id"])
293              dolibarr_print_error($db);              dolibarr_print_error($db);
294          }          }
295          print "</table>";          print "</table>";
296            print '<br>';
297          $db->free($result);          $db->free($result);
298      }      }
299  }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26