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