/[dolibarr]/dolibarr/htdocs/telephonie/contrat/services.php
ViewVC logotype

Diff of /dolibarr/htdocs/telephonie/contrat/services.php

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

revision 1.6 by rodolphe, Wed Sep 7 08:22:36 2005 UTC revision 1.7 by rodolphe, Tue Sep 27 08:57:56 2005 UTC
# Line 24  require "./pre.inc.php"; Line 24  require "./pre.inc.php";
24    
25  $mesg = '';  $mesg = '';
26    
27  if ($_POST["action"] == 'addservice' && $user->rights->telephonie->ligne->creer)  if ($_POST["action"] == 'addservice' && $user->rights->telephonie->service->affecter)
28  {  {
29    $contrat = new TelephonieContrat($db);    $contrat = new TelephonieContrat($db);
30    $contrat->id= $_GET["id"];    $contrat->id= $_GET["id"];
# Line 35  if ($_POST["action"] == 'addservice' && Line 35  if ($_POST["action"] == 'addservice' &&
35      }      }
36  }  }
37    
38  if ($_GET["action"] == 'rmservice' && $user->rights->telephonie->ligne->creer)  if ($_GET["action"] == 'rmservice' && $user->rights->telephonie->service->affecter)
39  {  {
40    $contrat = new TelephonieContrat($db);    $contrat = new TelephonieContrat($db);
41    $contrat->id= $_GET["id"];    $contrat->id= $_GET["id"];
# Line 134  if ($_GET["id"]) Line 134  if ($_GET["id"])
134            $commercial_suiv = new User($db, $contrat->commercial_suiv_id);            $commercial_suiv = new User($db, $contrat->commercial_suiv_id);
135            $commercial_suiv->fetch();            $commercial_suiv->fetch();
136                        
137                print '<tr><td width="20%">Commercial Suivi</td>';            print '<tr><td width="20%">Commercial Suivi</td>';
138                print '<td colspan="2">'.$commercial_suiv->fullname.'</td></tr>';            print '<td colspan="2">'.$commercial_suiv->fullname.'</td></tr>';
139    
140                /* Contacts */            /* Contacts */
141                print '<tr><td valign="top" width="20%">Contact facture</td>';            print '<tr><td valign="top" width="20%">Contact facture</td>';
142                print '<td valign="top" colspan="2">';            print '<td valign="top" colspan="2">';
143    
144                $sql = "SELECT c.idp, c.name, c.firstname, c.email ";            $sql = "SELECT c.idp, c.name, c.firstname, c.email ";
145                $sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c";            $sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c";
146                $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_contact_facture as cf";            $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_contact_facture as cf";
147                $sql .= " WHERE c.idp = cf.fk_contact AND cf.fk_contrat = ".$contrat->id." ORDER BY name ";            $sql .= " WHERE c.idp = cf.fk_contact AND cf.fk_contrat = ".$contrat->id." ORDER BY name ";
148                if ( $db->query( $sql) )            if ( $db->query( $sql) )
149                {
150                  $num = $db->num_rows();
151                  if ( $num > 0 )
152                  {                  {
153                    $num = $db->num_rows();                    $i = 0;
154                    if ( $num > 0 )                    while ($i < $num)
155                      {                      {
156                        $i = 0;                        $row = $db->fetch_row($i);
                       while ($i < $num)  
                         {  
                           $row = $db->fetch_row($i);  
157    
158                            print $row[1] . " " . $row[2] . " &lt;".$row[3]."&gt;<br />";                        print $row[1] . " " . $row[2] . " &lt;".$row[3]."&gt;<br />";
159                            $i++;                        $i++;
                         }  
160                      }                      }
                   $db->free();      
   
                 }  
               else  
                 {  
                   print $sql;  
161                  }                  }
162                print '</td></tr>';                $db->free();    
163                /* Fin Contacts */  
164                }
165              else
166                {
167                  print $sql;
168                }
169              print '</td></tr>';
170              /* Fin Contacts */
171    
172                print "</table><br />";            print "</table><br />";
173    
174    
175                /* Services */            /* Services */
176                            
177                print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';            print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
178                                
179                $sql = "SELECT s.libelle, s.statut";            $sql = "SELECT s.libelle, s.statut";
180                $sql .= " , cs.rowid as serid, s.montant, cs.montant as montant_fac";            $sql .= " , cs.rowid as serid, s.montant, cs.montant as montant_fac";
181                $sql .= " , ".$db->pdate("cs.date_creat") . " as date_creat";            $sql .= " , ".$db->pdate("cs.date_creat") . " as date_creat";
182                $sql .= " , u.name, u.firstname";            $sql .= " , u.name, u.firstname";
183                $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service as cs";            $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service as cs";
184                $sql .= " , ".MAIN_DB_PREFIX."telephonie_service as s";            $sql .= " , ".MAIN_DB_PREFIX."telephonie_service as s";
185                $sql .= " , ".MAIN_DB_PREFIX."user as u";            $sql .= " , ".MAIN_DB_PREFIX."user as u";
186    
187                $sql .= " WHERE cs.fk_service = s.rowid";            $sql .= " WHERE cs.fk_service = s.rowid";
188                $sql .= " AND cs.fk_user_creat = u.rowid";            $sql .= " AND cs.fk_user_creat = u.rowid";
189                $sql .= " AND cs.fk_contrat = ".$contrat->id;            $sql .= " AND cs.fk_contrat = ".$contrat->id;
190                                
191                if ( $db->query( $sql) )            if ( $db->query( $sql) )
192                {
193                  $numlignes = $db->num_rows();
194                  if ( $numlignes > 0 )
195                  {                  {
196                    $numlignes = $db->num_rows();                    $i = 0;                    
197                    if ( $numlignes > 0 )                    $ligne = new LigneTel($db);
                     {  
                       $i = 0;                  
                       $ligne = new LigneTel($db);  
198                                                
199                        print '<tr class="liste_titre"><td>Service</td>';                    print '<tr class="liste_titre"><td>Service</td>';
200                        print '<td align="right">Montant Facturé</td>';                    print '<td align="right">Montant Facturé</td>';
201                        print '<td align="right">Montant du service</td>';                    print '<td align="right">Montant du service</td>';
202                        if ($user->rights->telephonie->ligne->creer)                                  if ($user->rights->telephonie->service->affecter)            
203                          print "<td>&nbsp;</td>\n";                      print "<td>&nbsp;</td>\n";
204                        print '<td align="center">Ajouté par</td>';                    print '<td align="center">Ajouté par</td>';
205                        print '<td align="center">Ajouté le</td></tr>';                    print '<td align="center">Ajouté le</td></tr>';
206                                                
207                        while ($i < $numlignes)                    while ($i < $numlignes)
208                          {                      {
209                            $obj = $db->fetch_object($i);                        $obj = $db->fetch_object($i);    
210                            $var=!$var;                        $var=!$var;
211                                                        
212                            print "<tr $bc[$var]><td>";                        print "<tr $bc[$var]><td>";
213                                                        
214                            print '<img src="../graph'.$obj->statut.'.png">&nbsp;';                        print '<img src="../graph'.$obj->statut.'.png">&nbsp;';
215                                                        
216                                                        
217                            print '<a href="'.DOL_URL_ROOT.'/telephonie/service/fiche.php?id='.$obj->serid.'">'.$obj->libelle."</a></td>\n";                        print '<a href="'.DOL_URL_ROOT.'/telephonie/service/fiche.php?id='.$obj->serid.'">'.$obj->libelle."</a></td>\n";
218                                                        
219                            print '<td align="right">'.price($obj->montant_fac)." euros HT</td>\n";                        print '<td align="right">'.price($obj->montant_fac)." euros HT</td>\n";
220                            print '<td align="right">'.price($obj->montant)." euros HT</td>\n";                        print '<td align="right">'.price($obj->montant)." euros HT</td>\n";
221    
222        if ($user->rights->telephonie->ligne->creer)                        if ($user->rights->telephonie->service->affecter)
223          {                          {
224                            print '<td align="center"><a href="services.php?id='.$contrat->id.'&amp;action=rmservice&amp;service_id='.$obj->serid.'">';                            print '<td align="center"><a href="services.php?id='.$contrat->id.'&amp;action=rmservice&amp;service_id='.$obj->serid.'">';
225                            print img_delete();                            print img_delete();
226                            print "</a></td>";                            print "</a></td>";
         }  
                           print '<td align="center">'.$obj->firstname.' '.$obj->name.'</td>';  
                           print '<td align="center">'.strftime("%d/%m/%y",$obj->date_creat).'</td>';  
                           print "</tr>\n";  
                           $i++;  
227                          }                          }
228                          print '<td align="center">'.$obj->firstname.' '.$obj->name.'</td>';
229                          print '<td align="center">'.strftime("%d/%m/%y",$obj->date_creat).'</td>';
230                          print "</tr>\n";
231                          $i++;
232                      }                      }
                   $db->free();      
                     
233                  }                  }
234                else                $db->free();    
235                  {                    
                   print $db->error();  
                   print $sql;  
                 }  
                 
               print "</table>";  
   
   
236              }              }
237                                else
238                {
239            /*                print $db->error();
240             * Service                print $sql;
241             *              }
242             *                
243             */            print "</table>";
244            }                
245        if ($user->rights->telephonie->ligne->creer)        /*
246          {         * Service
247           *
248           *
249           */      
250          if ($user->rights->telephonie->service->affecter)
251            {        
252            print_fiche_titre('Ajouter un service', $mesg);            print_fiche_titre('Ajouter un service', $mesg);
253                        
254            print '<form action="services.php?id='.$contrat->id.'" method="post">';            print '<form action="services.php?id='.$contrat->id.'" method="post">';
255            print '<input type="hidden" name="action" value="addservice">';            print '<input type="hidden" name="action" value="addservice">';        
             
256            print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';            print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
257            print '<tr><td valign="top" width="20%">Service</td><td valign="top" colspan="2">';            print '<tr><td valign="top" width="20%">Service</td><td valign="top" colspan="2">';
258                        
# Line 301  if ($_GET["id"]) Line 294  if ($_GET["id"])
294            print '</table>';            print '</table>';
295            print '</form>';            print '</form>';
296          }          }
297            /*        /*
298             *         *
299             *         *
300             *         *
301             */         */
302                        
303            print '</div>';        print '</div>';
304                        
         }  
305      }      }
306    }
307  else  else
308  {  {
309    print "Error";    print "Error";

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

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