[ 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/compta/prelevement/ -> fiche.php (source)

   1  <?PHP
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   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.16 2005/09/10 14:26:15 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/prelevement/fiche.php,v $
  21   */
  22   
  23  /**
  24          \file       htdocs/compta/prelevement/fiche.php
  25          \ingroup    prelevement
  26          \brief      Fiche prelevement
  27          \version    $Revision: 1.16 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  if (!$user->rights->prelevement->bons->lire)
  33    accessforbidden();
  34  
  35  $langs->load("bills");
  36  
  37  /*
  38   * Sécurité accés client
  39   */
  40  if ($user->societe_id > 0) accessforbidden();
  41  
  42  if ($_POST["action"] == 'confirm_credite' && $_POST["confirm"] == yes)
  43  {
  44    $bon = new BonPrelevement($db,"");
  45    $bon->id = $_GET["id"];
  46    $bon->set_credite();
  47  
  48    Header("Location: fiche.php?id=".$_GET["id"]);
  49  }
  50  
  51  if ($_POST["action"] == 'infotrans')
  52  {
  53    $bon = new BonPrelevement($db,"");
  54    $bon->fetch($_GET["id"]);
  55  
  56    if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $bon->ref)
  57      {      
  58        $dir = $conf->prelevement->dir_output.'/bon/';
  59  
  60        if (doliMoveFileUpload($_FILES['userfile']['tmp_name'], $dir . "/" . $_FILES['userfile']['name']))
  61      {
  62        $dt = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
  63        
  64        $bon->set_infotrans($user, $dt, $_POST["methode"]);
  65      }
  66      }
  67    else
  68      {
  69        dolibarr_syslog("Fichier invalide",LOG_WARN);
  70      }
  71  
  72    Header("Location: fiche.php?id=".$_GET["id"]);
  73  }
  74  
  75  if ($_POST["action"] == 'infocredit')
  76  {
  77    $bon = new BonPrelevement($db,"");
  78    $bon->Fetch($_GET["id"]);
  79    $dt = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
  80  
  81    $error = $bon->set_infocredit($user, $dt);
  82  
  83    if ($error == 0)
  84      {
  85        Header("Location: fiche.php?id=".$_GET["id"]);
  86      }
  87    else
  88      {
  89        Header("Location: fiche.php?id=".$_GET["id"]."&error=$error");
  90      }
  91  }
  92  
  93  llxHeader('','Bon de prélèvement');
  94  
  95  $h = 0;
  96  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
  97  $head[$h][1] = $langs->trans("Card");
  98  $hselected = $h;
  99  $h++;      
 100  
 101  if ($conf->use_preview_tabs)
 102  {
 103      $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
 104      $head[$h][1] = $langs->trans("Preview");
 105      $h++;  
 106  }
 107  
 108  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
 109  $head[$h][1] = $langs->trans("Lines");
 110  $h++;  
 111  
 112  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
 113  $head[$h][1] = $langs->trans("Bills");
 114  $h++;  
 115  
 116  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
 117  $head[$h][1] = $langs->trans("Rejects");
 118  $h++;  
 119  
 120  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
 121  $head[$h][1] = $langs->trans("Statistics");
 122  $h++;  
 123  
 124  $prev_id = $_GET["id"];
 125  
 126  $html = new Form($db);
 127  
 128  if ($_GET["id"])
 129  {
 130    $bon = new BonPrelevement($db,"");
 131  
 132    if ($bon->fetch($_GET["id"]) == 0)
 133      {
 134        dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref);
 135  
 136        if (isset($_GET["error"]))
 137      {
 138        print '<div class="error">'.$bon->ReadError($_GET["error"]).'</div>';
 139      }
 140  
 141  
 142  
 143        if ($_GET["action"] == 'credite')
 144      {
 145        $html->form_confirm("fiche.php?id=".$bon->id,"Classer comme crédité","Etes-vous sûr de vouloir classer ce bon de prélèvement comme crédité sur votre compte bancaire ?","confirm_credite");
 146        print '<br />';
 147      }
 148  
 149        print '<table class="border" width="100%">';
 150  
 151        print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->ref.'</td></tr>';
 152        print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.strftime("%e %B %Y",$bon->datec).'</td></tr>';
 153        print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
 154        print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
 155  
 156        $relativepath = 'bon/'.$bon->ref;
 157  
 158        print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$bon->ref.'</a>';
 159  
 160        print '</td></tr>';
 161  
 162        print '<tr><td width="20%">Statut</td><td>';
 163        print '<img src="./statut'.$bon->statut.'.png">&nbsp;';
 164        print $lipre->statuts[$lipre->statut].'</td></tr>';
 165  
 166        if($bon->date_trans <> 0)
 167      {
 168        $muser = new User($db, $bon->user_trans);
 169        $muser->fetch();
 170  
 171        print '<tr><td width="20%">Date Transmission / Par</td><td>';
 172        print strftime("%e %B %Y",$bon->date_trans);
 173        print ' par '.$muser->fullname.'</td></tr>';
 174        print '<tr><td width="20%">Méthode Transmission</td><td>';
 175        print $bon->methodes_trans[$bon->method_trans];
 176        print '</td></tr>';
 177      }
 178        if($bon->date_credit <> 0)
 179      {
 180        print '<tr><td width="20%">Crédité le</td><td>';
 181        print strftime("%e %B %Y",$bon->date_credit);
 182        print '</td></tr>';
 183      }
 184  
 185        print '</table><br />';
 186  
 187        if($bon->date_trans == 0)
 188      {
 189        print '<form method="post" name="userfile" action="fiche.php?id='.$bon->id.'" enctype="multipart/form-data">';
 190        print '<input type="hidden" name="action" value="infotrans">';
 191        print '<table class="border" width="100%">';
 192        print '<tr><td width="20%">Date Transmission</td><td>';
 193        print $html->select_date();
 194        print '</td></tr>';
 195        print '<tr><td width="20%">Méthode Transmission</td><td>';
 196        print $html->select_array("methode",$bon->methodes_trans);
 197        print '</td></tr>';
 198        print '<tr><td width="20%">Fichier</td><td>';
 199        print '<input type="file" name="userfile" size="30" maxlength="80"><br />';
 200        print '</td></tr>';
 201        print '<tr><td colspan="2" align="center">';
 202        print '<input type="submit" class="button" value="'.$langs->trans("Send").'">';
 203        print '</td></tr>';
 204        print '</table></form>';
 205      }
 206  
 207        if($bon->date_trans <> 0 && $bon->date_credit == 0)
 208      {
 209        print '<form method="post" action="fiche.php?id='.$bon->id.'">';
 210        print '<input type="hidden" name="action" value="infocredit">';
 211        print '<table class="border" width="100%">';
 212        print '<tr><td width="20%">Crédité le</td><td>';
 213        print $html->select_date();
 214        print '</td></tr>';
 215        print '<tr><td colspan="2" align="center">';
 216        print '<input type="submit" class="button" value="'.$langs->trans("Send").'">';
 217        print '</td></tr>';
 218        print '</table></form>';
 219      }
 220  
 221      }
 222    else
 223      {
 224        dolibarr_print_error($db);
 225      }
 226  }
 227  
 228  /* ************************************************************************** */
 229  /*                                                                            */
 230  /* Barre d'action                                                             */
 231  /*                                                                            */
 232  /* ************************************************************************** */
 233  
 234  print "\n</div>\n<div class=\"tabsAction\">\n";
 235  
 236  if ($_GET["action"] == '')
 237  {  
 238    
 239    if ($bon->credite == 0)
 240      {      
 241        print "<a class=\"tabAction\" href=\"fiche.php?action=credite&amp;id=$bon->id\">".$langs->trans("Classer crédité")."</a>";
 242      }
 243  
 244  
 245        
 246  }
 247  
 248  print "</div>";
 249  
 250  
 251  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/10 14:26:15 $ r&eacute;vision $Revision: 1.16 $</em>");
 252  ?>


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