[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/fourn/paiement/ -> fiche.php (source)

   1  <?php
   2  /* Copyright (C) 2005      Rodolphe Quiedeville  <rodolphe@quiedeville.org>
   3   * Copyright (C) 2005      Marc Barilley / Ocebo <marc@ocebo.com>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: fiche.php,v 1.5 2005/11/19 02:53:04 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/fourn/paiement/fiche.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/fourn/paiement/fiche.php
  25          \ingroup    facture
  26          \brief      Onglet paiement d'un paiement
  27          \version    $Revision: 1.5 $
  28  */
  29  
  30  
  31  require ('./pre.inc.php');
  32  
  33  require(DOL_DOCUMENT_ROOT.'/fourn/facture/paiementfourn.class.php');
  34  
  35  $user->getrights('facture');
  36  
  37  $langs->load('bills');
  38  $langs->load('banks');
  39  $langs->load('companies');
  40  
  41  $mesg='';
  42  
  43  
  44  /*
  45   * Actions
  46   */
  47  if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->facture->creer)
  48  {
  49      $db->begin();
  50  
  51      $paiement = new PaiementFourn($db);
  52      $paiement->fetch($_GET['id']);
  53      $result = $paiement->delete();
  54      if ($result > 0)
  55      {
  56          $db->commit();
  57          Header('Location: /fourn/facture/paiement.php');
  58          exit;
  59      }
  60      else
  61      {
  62          $mesg='<div class="error">'.$paiement->error.'</div>';
  63          $db->rollback();
  64      }
  65  }
  66  
  67  if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->facture->creer)
  68  {
  69      $db->begin();
  70  
  71      $paiement = new PaiementFourn($db);
  72      $paiement->id = $_GET['id'];
  73      if ( $paiement->valide() == 0 )
  74      {
  75          $db->commit();
  76          Header('Location: fiche.php?id='.$paiement->id);
  77          exit;
  78      }
  79      else
  80      {
  81          $mesg='<div class="error">'.$paiement->error.'</div>';
  82          $db->rollback();
  83      }
  84  }
  85  
  86  
  87  /*
  88   * Visualisation de la fiche
  89   */
  90  
  91  llxHeader();
  92  
  93  $paiement = new PaiementFourn($db);
  94  $paiement->fetch($_GET['id']);
  95  
  96  $html = new Form($db);
  97  
  98  $h=0;
  99  
 100  $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$_GET['id'];
 101  $head[$h][1] = $langs->trans('Card');
 102  $hselected = $h;
 103  $h++;
 104  
 105  $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$_GET['id'];
 106  $head[$h][1] = $langs->trans('Info');
 107  $h++;
 108  
 109  
 110  dolibarr_fiche_head($head, $hselected, $langs->trans('Payment').': '.$paiement->ref);
 111  
 112  /*
 113   * Confirmation de la suppression du paiement
 114   */
 115  if ($_GET['action'] == 'delete')
 116  {
 117      $html->form_confirm('fiche.php?id='.$paiement->id, 'Supprimer le paiement', 'Etes-vous sûr de vouloir supprimer ce paiement ?', 'confirm_delete');
 118      print '<br>';
 119  }
 120  
 121  /*
 122   * Confirmation de la validation du paiement
 123   */
 124  if ($_GET['action'] == 'valide')
 125  {
 126      $html->form_confirm('fiche.php?id='.$paiement->id, 'Valider le paiement', 'Etes-vous sûr de vouloir valider ce paiment, auncune modification n\'est possible une fois le paiement validé ?', 'confirm_valide');
 127      print '<br>';
 128  }
 129  
 130  
 131  if ($mesg) print $mesg.'<br>';
 132  
 133  
 134  print '<table class="border" width="100%">';
 135  
 136  print '<tr><td valign="top" width="140">'.$langs->trans('Ref').'</td><td colspan="3">'.$paiement->id.'</td></tr>';
 137  if ($conf->banque->enabled)
 138  {
 139      if ($paiement->bank_account)
 140      {
 141          // Si compte renseigné, on affiche libelle
 142          $bank=new Account($db);
 143          $bank->fetch($paiement->bank_account);
 144  
 145          $bankline=new AccountLine($db);
 146          $bankline->fetch($paiement->bank_line);
 147  
 148          print '<tr>';
 149          print '<td valign="top" width="140">'.$langs->trans('BankAccount').'</td>';
 150          print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$bank->id.'">'.img_object($langs->trans('ShowAccount'),'account').' '.$bank->label.'</a></td>';
 151          print '<td>'.$langs->trans('BankLineConciliated').'</td><td>'.yn($bankline->rappro).'</td>';
 152          print '</tr>';
 153      }
 154  }
 155  print '<tr><td valign="top" width="140">'.$langs->trans('Date').'</td><td colspan="3">'.dolibarr_print_date($paiement->date).'</td></tr>';
 156  print '<tr><td valign="top">'.$langs->trans('Type').'</td><td colspan="3">'.$paiement->type_libelle.'</td></tr>';
 157  if ($paiement->numero)
 158  {
 159      print '<tr><td valign="top">'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->numero.'</td></tr>';
 160  }
 161  print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->montant).'&nbsp;'.$langs->trans('Currency'.$conf->monnaie).'</td></tr>';
 162  print '<tr><td valign="top">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
 163  print '</table>';
 164  
 165  
 166  /*
 167   *
 168   *
 169   */
 170  $allow_delete = 1 ;
 171  $sql = 'SELECT f.facnumber, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom, s.idp';
 172  $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf,'.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s';
 173  $sql .= ' WHERE pf.fk_facturefourn = f.rowid AND f.fk_soc = s.idp';
 174  $sql .= ' AND pf.fk_paiementfourn = '.$paiement->id;
 175  $resql=$db->query($sql);
 176  if ($resql)
 177  {
 178      $num = $db->num_rows($resql);
 179  
 180      $i = 0;
 181      $total = 0;
 182      print '<br><table class="noborder" width="100%">';
 183      print '<tr class="liste_titre">';
 184      print '<td width="80">'.$langs->trans('Bill').'</td>';
 185      print '<td width="80" align="center">'.$langs->trans('Status').'</td>';
 186      print '<td>'.$langs->trans('Company').'</td>';
 187      print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
 188      print "</tr>\n";
 189  
 190      if ($num > 0)
 191      {
 192          $var=True;
 193  
 194          $fac_static=new FactureFournisseur($db);
 195          while ($i < $num)
 196          {
 197              $objp = $db->fetch_object($resql);
 198              $var=!$var;
 199              print '<tr '.$bc[$var].'>';
 200              print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$objp->facid.'">'.img_object($langs->trans('ShowBill'),'bill').' ';
 201              print $objp->facnumber;
 202              print "</a></td>\n";
 203              print '<td align="center">'.$fac_static->LibStatut($objp->paye,$objp->fk_statut).'</td>';
 204              print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objp->idp.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
 205              print '<td align="right">'.price($objp->amount).'</td>';
 206              print "</tr>\n";
 207              if ($objp->paye == 1)
 208              {
 209                  $allow_delete = 0;
 210              }
 211              $total = $total + $objp->amount;
 212              $i++;
 213          }
 214      }
 215      $var=!$var;
 216  
 217      print "</table>\n";
 218      $db->free($resql);
 219  }
 220  else
 221  {
 222      dolibarr_print_error($db);
 223  }
 224  
 225  print '</div>';
 226  
 227  
 228  /*
 229   * Boutons Actions
 230   */
 231  
 232  print '<div class="tabsAction">';
 233  
 234  if ($user->societe_id == 0 && $paiement->statut == 0 && $_GET['action'] == '')
 235  {
 236      print '<a class="tabAction" href="fiche.php?id='.$_GET['id'].'&amp;action=valide">'.$langs->trans('Valid').'</a>';
 237  }
 238  
 239  if ($user->societe_id == 0 && $allow_delete && $paiement->statut == 0 && $_GET['action'] == '')
 240  {
 241      print '<a class="butDelete" href="fiche.php?id='.$_GET['id'].'&amp;action=delete">'.$langs->trans('Delete').'</a>';
 242  }
 243  print '</div>';
 244  
 245  $db->close();
 246  
 247  llxFooter('$Date: 2005/11/19 02:53:04 $ - $Revision: 1.5 $');
 248  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics