/[dolibarr]/dolibarr/htdocs/comm/propal.php
ViewVC logotype

Diff of /dolibarr/htdocs/comm/propal.php

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

revision 1.129 by eldy, Sat Oct 8 15:54:08 2005 UTC revision 1.130 by eldy, Fri Nov 4 20:45:02 2005 UTC
# Line 80  if ($_POST['action'] == 'confirm_delete' Line 80  if ($_POST['action'] == 'confirm_delete'
80          $brouillon = 1;          $brouillon = 1;
81      }      }
82      Header('Location: propal.php');      Header('Location: propal.php');
83        exit;
84  }  }
85    
86  if ($_POST['action'] == 'confirm_validate' && $_POST['confirm'] == 'yes')  if ($_POST['action'] == 'confirm_validate' && $_POST['confirm'] == 'yes')
# Line 88  if ($_POST['action'] == 'confirm_validat Line 89  if ($_POST['action'] == 'confirm_validat
89      {      {
90          $propal = new Propal($db);          $propal = new Propal($db);
91          $propal->fetch($_GET['propalid']);          $propal->fetch($_GET['propalid']);
92          $propal->update_price($_GET['propalid']);          $result=$propal->update_price($_GET['propalid']);
93          propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf);          propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf);
94          $propal->valid($user);          $result=$propal->valid($user);
95      }      }
96      Header ('Location: propal.php?propalid='.$_GET['propalid']);      Header ('Location: propal.php?propalid='.$_GET['propalid']);
97        exit;
98    }
99    
100    if ($_POST['action'] == 'setecheance')
101    {
102            $propal = new Propal($db);
103        $propal->fetch($_GET['propalid']);
104            $result=$propal->set_echeance($user,mktime(12, 1, 1, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
105            if ($result < 0) dolibarr_print_error($db,$propal->error);
106  }  }
107    
108  if ($_POST['action'] == 'add')  if ($_POST['action'] == 'add')
109  {  {
110      $propal = new Propal($db, $_GET['socidp']);      $propal = new Propal($db, $_GET['socidp']);
111      $propal->datep = mktime(12, 1 , 1, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);      $propal->datep = mktime(12, 1, 1, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
112    
113      $propal->duree_validite = $_POST['duree_validite'];      $propal->duree_validite = $_POST['duree_validite'];
114    
# Line 138  if ($_POST['action'] == 'add') Line 148  if ($_POST['action'] == 'add')
148    
149  if ($_GET['action'] == 'pdf')  if ($_GET['action'] == 'pdf')
150  {  {
151    $propal = new Propal($db);      $propal = new Propal($db);
152    $propal->fetch($_GET['propalid']);      $propal->fetch($_GET['propalid']);
153    propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf);      propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf);
154  }  }
155    
156    /*
157     *  Cloture de la propale
158     */
159  if ($_POST['action'] == 'setstatut' && $user->rights->propale->cloturer)  if ($_POST['action'] == 'setstatut' && $user->rights->propale->cloturer)
160  {  {
161    /*      $propal = new Propal($db);
162     *  Cloture de la propale      $propal->fetch($_GET['propalid']);
163     */      $propal->cloture($user, $_POST['statut'], $_POST['note']);
   $propal = new Propal($db);  
   $propal->fetch($_GET['propalid']);  
   $propal->cloture($user, $_POST['statut'], $_POST['note']);  
164  }  }
165    
166  /*  /*
167   * Envoi de la propale par mail   * Envoi de la propale par mail
  *  
168   */   */
169  if ($_POST['action'] == 'send')  if ($_POST['action'] == 'send')
170  {  {
# Line 362  if ($_POST['action'] == 'set_contact') Line 371  if ($_POST['action'] == 'set_contact')
371    
372  llxHeader();  llxHeader();
373    
374    $html = new Form($db);
375    
376  /*  /*
377   * Affichage fiche propal en mode visu   * Affichage fiche propal en mode visu
# Line 370  llxHeader(); Line 380  llxHeader();
380  if ($_GET['propalid'] > 0)  if ($_GET['propalid'] > 0)
381  {  {
382    if ($msg) print "$msg<br>";    if ($msg) print "$msg<br>";
   $html = new Form($db);  
383    
384    $propal = new Propal($db);    $propal = new Propal($db);
385    $propal->fetch($_GET['propalid']);    $propal->fetch($_GET['propalid']);
# Line 450  if ($_GET['propalid'] > 0) Line 459  if ($_GET['propalid'] > 0)
459            
460              print '<table class="border" width="100%">';              print '<table class="border" width="100%">';
461              $rowspan=6;              $rowspan=6;
462              print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">';              
463                // Société
464                print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">';
465              if ($societe->client == 1)              if ($societe->client == 1)
466              {              {
467                  $url ='fiche.php?socid='.$societe->id;                  $url ='fiche.php?socid='.$societe->id;
# Line 460  if ($_GET['propalid'] > 0) Line 471  if ($_GET['propalid'] > 0)
471                  $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id;                  $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id;
472              }              }
473              print '<a href="'.$url.'">'.$societe->nom.'</a></td>';              print '<a href="'.$url.'">'.$societe->nom.'</a></td>';
             print '<td align="left">Conditions de réglement</td>';  
             print '<td>'.'&nbsp;'.'</td>';  
474              print '</tr>';              print '</tr>';
475            
476                // Dates
477              print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';              print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
478              print dolibarr_print_date($propal->date,'%a %d %B %Y');              print dolibarr_print_date($propal->date,'%a %d %B %Y');
479              print '</td>';              print '</td>';
480            
481              print '<td>'.$langs->trans('DateEndPropal').'</td><td>';                          print '<td>';
482              if ($propal->fin_validite)                          print '<table class="nobordernopadding" width="100%"><tr><td>';
483                            print $langs->trans('DateEndPropal');
484                            print '</td>';
485                            if ($_GET['action'] != 'editecheance' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editecheance&amp;propalid='.$propal->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
486                            print '</tr></table>';
487                print '<td>';
488                if ($propal->brouillon && $_GET['action'] == 'editecheance')
489              {              {
490                  print dolibarr_print_date($propal->fin_validite,'%a %d %B %Y');                  print '<form action="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'" method="post">';
491                  if ($propal->statut == 1 && $propal->fin_validite < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));                  print '<input type="hidden" name="action" value="setecheance">';
492                    $html->select_date($propal->fin_validite,'ech');
493                    print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
494                    print '</form>';
495              }              }
496              else              else
497              {              {
498                  print $langs->trans("Unknown");                  if ($propal->fin_validite)
499                    {
500                        print dolibarr_print_date($propal->fin_validite,'%a %d %B %Y');
501                        if ($propal->statut == 1 && $propal->fin_validite < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
502                    }
503                    else
504                    {
505                        print $langs->trans("Unknown");
506                    }
507              }              }
508              print '</td>';              print '</td>';
509              print '</tr>';              print '</tr>';
510            
511                            // Conditions et modes de réglement
512                            print '<tr><td>';
513                            print '<table class="nobordernopadding" width="100%"><tr><td>';
514                            print $langs->trans('PaymentConditions');
515                            print '</td>';
516    //                      if ($_GET['action'] != 'editconditions' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;facid='.$propal->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
517                            print '</tr></table>';
518                            print '</td><td colspan="3">';
519                            if ($_GET['action'] == 'editconditions')
520                            {
521                                    $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->cond_reglement_id,'cond_reglement_id');
522                            }
523                            else
524                            {
525                                    $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->cond_reglement_id,'none');
526                            }
527                            print '</td>';
528                            print '<td width="25%">';
529                            print '<table class="nobordernopadding" width="100%"><tr><td>';
530                            print $langs->trans('PaymentMode');
531                            print '</td>';
532    //                      if ($_GET['action'] != 'editmode' && $propal->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;facid='.$propal->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
533                            print '</tr></table>';
534                            print '</td><td width="25%">';
535                            if ($_GET['action'] == 'editmode')
536                            {
537                                    $html->form_modes_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->mode_reglement_id,'mode_reglement_id');
538                            }
539                            else
540                            {
541                                    $html->form_modes_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->mode_reglement_id,'none');
542                            }
543                            print '</td></tr>';
544    
545              // Destinataire              // Destinataire
546              $langs->load('mails');              $langs->load('mails');
547              print '<tr>';              print '<tr>';
# Line 502  if ($_GET['propalid'] > 0) Line 563  if ($_GET['propalid'] > 0)
563                      print '<td colspan="2">';                      print '<td colspan="2">';
564                      print '<form action="propal.php?propalid='.$propal->id.'" method="post">';                      print '<form action="propal.php?propalid='.$propal->id.'" method="post">';
565                      print '<input type="hidden" name="action" value="set_contact">';                      print '<input type="hidden" name="action" value="set_contact">';
566                      $form->select_contacts($societe->id, $propal->contactid, 'contactidp');                      $html->select_contacts($societe->id, $propal->contactid, 'contactidp');
567                      print '</td><td>';                      print '</td><td>';
568                      print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';                      print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
569                      print '</form>';                      print '</form>';
# Line 513  if ($_GET['propalid'] > 0) Line 574  if ($_GET['propalid'] > 0)
574                      if (!empty($propal->contactid))                      if (!empty($propal->contactid))
575                      {                      {
576                          print '<td colspan="3">';                          print '<td colspan="3">';
577                          include_once(DOL_DOCUMENT_ROOT."/contact.class.php");                          require_once(DOL_DOCUMENT_ROOT.'/contact.class.php');
578                          $contact=new Contact($db);                          $contact=new Contact($db);
579                          $contact->fetch($propal->contactid);                          $contact->fetch($propal->contactid);
580                          print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$propal->contactid.'" title="'.$langs->trans('ShowContact').'">';                          print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$propal->contactid.'" title="'.$langs->trans('ShowContact').'">';
# Line 952  if ($_GET['propalid'] > 0) Line 1013  if ($_GET['propalid'] > 0)
1013            
1014      $var=true;      $var=true;
1015            
1016      $form->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);      $html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
1017    
1018    
1019    /*    /*
# Line 1168  else Line 1229  else
1229        $var=true;        $var=true;
1230    
1231        while ($i < min($num,$limit))        while ($i < min($num,$limit))
1232          {          {
1233            $objp = $db->fetch_object($result);              $objp = $db->fetch_object($result);
1234            $now = time();              $now = time();
1235            $var=!$var;              $var=!$var;
1236            print '<tr '.$bc[$var].'>';              print '<tr '.$bc[$var].'>';
1237            print '<td><a href="propal.php?propalid='.$objp->propalid.'">'.img_object($langs->trans('ShowPropal'),'propal').' '.$objp->ref."</a></td>\n";              print '<td><a href="propal.php?propalid='.$objp->propalid.'">'.img_object($langs->trans('ShowPropal'),'propal').' '.$objp->ref."</a></td>\n";
1238            
1239            if ($objp->client == 1)              if ($objp->client == 1)
1240              {              {
1241                $url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->idp;                  $url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->idp;
1242              }              }
1243            else              else
1244              {              {
1245                $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$objp->idp;                  $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$objp->idp;
1246              }              }
1247            print '<td><a href="'.$url.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';              print '<td><a href="'.$url.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
1248            
1249            // Date propale              // Date propale
1250            print '<td align="center">';              print '<td align="center">';
1251            $y = strftime('%Y',$objp->dp);              $y = strftime('%Y',$objp->dp);
1252            $m = strftime('%m',$objp->dp);              $m = strftime('%m',$objp->dp);
1253            
1254            print strftime('%d',$objp->dp)."\n";              print strftime('%d',$objp->dp)."\n";
1255            print ' <a href="propal.php?year='.$y.'&amp;month='.$m.'">';              print ' <a href="propal.php?year='.$y.'&amp;month='.$m.'">';
1256            print dolibarr_print_date($objp->dp,'%b')."</a>\n";              print dolibarr_print_date($objp->dp,'%b')."</a>\n";
1257            print ' <a href="propal.php?year='.$y.'">';              print ' <a href="propal.php?year='.$y.'">';
1258            print strftime('%Y',$objp->dp)."</a></td>\n";                    print strftime('%Y',$objp->dp)."</a></td>\n";
1259            
1260            // Date fin validite              // Date fin validite
1261            if ( $now > $objp->dfv && $objp->dfv > 0 )              if ($objp->dfv)
1262              {              {
1263                print '<td align="center">'.dolibarr_print_date($objp->dfv);                  print '<td align="center">'.dolibarr_print_date($objp->dfv);
1264                    if ($objp->fk_statut == 1 && $objp->dfv < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));                  if ($objp->fk_statut == 1 && $objp->dfv < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
1265                print '</td>';                  print '</td>';
1266              }              }
1267            else              else
1268              {              {
1269                print '<td>&nbsp;</td>';                  print '<td>&nbsp;</td>';
1270              }              }
1271            
1272            print '<td align="right">'.price($objp->price)."</td>\n";              print '<td align="right">'.price($objp->price)."</td>\n";
1273            $propal=New Propal($db);              $propal=New Propal($db);
1274            print '<td align="center">'.$propal->LibStatut($objp->fk_statut,0)."</td>\n";              print '<td align="center">'.$propal->LibStatut($objp->fk_statut,0)."</td>\n";
1275            print "</tr>\n";              print "</tr>\n";
1276            
1277            $total = $total + $objp->price;              $total = $total + $objp->price;
1278            $subtotal = $subtotal + $objp->price;              $subtotal = $subtotal + $objp->price;
1279            
1280            $i++;              $i++;
1281          }          }
1282        print '</table>';        print '</table>';
1283        $db->free($result);        $db->free($result);
1284      }      }

Legend:
Removed from v.1.129  
changed lines
  Added in v.1.130

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