[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?PHP 2 /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id: ligne.php,v 1.10 2005/11/16 14:43:14 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/prelevement/ligne.php,v $ 20 */ 21 22 require ("./pre.inc.php"); 23 require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/ligne-prelevement.class.php"); 24 require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/rejet-prelevement.class.php"); 25 require_once(DOL_DOCUMENT_ROOT."/paiement.class.php"); 26 27 // Sécurité accés client 28 if ($user->societe_id > 0) accessforbidden(); 29 30 31 if ($_POST["action"] == 'confirm_rejet') 32 { 33 if ( $_POST["confirm"] == 'yes') 34 { 35 36 $daterej = mktime(2, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); 37 38 $lipre = new LignePrelevement($db, $user); 39 40 if ($lipre->fetch($_GET["id"]) == 0) 41 { 42 43 if ($_POST["motif"] > 0 && $daterej < time()) 44 { 45 $rej = new RejetPrelevement($db, $user); 46 47 $rej->create($user, $_GET["id"], $_POST["motif"], $daterej, $lipre->bon_rowid, $_POST["facturer"]); 48 49 Header("Location: ligne.php?id=".$_GET["id"]); 50 } 51 else 52 { 53 dolibarr_syslog("Motif : ".$_POST["motif"]); 54 dolibarr_syslog("$daterej $time "); 55 Header("Location: ligne.php?id=".$_GET["id"]."&action=rejet"); 56 } 57 } 58 } 59 else 60 { 61 Header("Location: ligne.php?id=".$_GET["id"]); 62 } 63 } 64 65 66 llxHeader('','Prélèvement'); 67 68 $h = 0; 69 $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$_GET["id"]; 70 $head[$h][1] = $langs->trans("Fiche"); 71 $hselected = $h; 72 $h++; 73 74 if ($_GET["id"]) 75 { 76 $lipre = new LignePrelevement($db, $user); 77 78 if ($lipre->fetch($_GET["id"]) == 0) 79 { 80 $bon = new BonPrelevement($db); 81 $bon->fetch($lipre->bon_rowid); 82 83 dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $lipre->bon_ref); 84 85 print '<table class="border" width="100%">'; 86 87 print '<tr><td width="20%">Bons de prélèvement</td><td>'; 88 print '<a href="fiche.php?id='.$lipre->bon_rowid.'">'.$lipre->bon_ref.'</a></td></tr>'; 89 print '<tr><td width="20%">Montant</td><td>'.price($lipre->amount).'</td></tr>'; 90 print '<tr><td width="20%">Statut</td><td>'; 91 print '<img src="./statut'.$lipre->statut.'.png"> '; 92 print $lipre->statuts[$lipre->statut].'</td></tr>'; 93 94 if ($lipre->statut == 3) 95 { 96 $rej = new RejetPrelevement($db, $user); 97 $resf = $rej->fetch($lipre->id); 98 if ($resf == 0) 99 { 100 print '<tr><td width="20%">Motif du rejet</td><td>'.$rej->motif.'</td></tr>'; 101 print '<tr><td width="20%">Date du rejet</td><td>'; 102 if ($rej->date_rejet == 0) 103 { 104 /* Historique pour certaines install */ 105 print "Inconnue"; 106 } 107 else 108 { 109 print strftime("%d %B %Y",$rej->date_rejet); 110 } 111 print '</td></tr>'; 112 } 113 else 114 { 115 print '<tr><td width="20%">'.$resf.'</td></tr>'; 116 } 117 } 118 119 120 print '</table><br />'; 121 } 122 else 123 { 124 print "Erreur"; 125 } 126 127 128 129 if ($_GET["action"] == 'rejet') 130 { 131 $html = new Form($db); 132 133 $soc = new Societe($db); 134 $soc->fetch($lipre->socid); 135 136 $rej = new RejetPrelevement($db, $user); 137 138 print '<form method="post" action="ligne.php?id='.$_GET["id"].'">'; 139 print '<input type="hidden" name="action" value="confirm_rejet">'; 140 print '<table class="border" width="100%">'; 141 print '<tr><td colspan="3">Rejet de prélèvement</td></tr>'; 142 print '<tr><td class="valid">Etes-vous sûr de vouloir saisir un rejet de prélèvement pour la société '.$soc->nom.' ?</td>'; 143 print '<td colspan="2" class="valid">'; 144 print '<select name="confirm">'; 145 print '<option value="yes">oui</option>'; 146 print '<option value="no" selected="true">non</option>'; 147 print '</select>'; 148 print '</td></tr>'; 149 150 print '<tr><td class="valid">Date du rejet</td>'; 151 print '<td colspan="2" class="valid">'; 152 print $html->select_date(); 153 print '</td></tr>'; 154 print '<tr><td class="valid">Motif du rejet</td>'; 155 print '<td class="valid">'; 156 print '<select name="motif">'; 157 print '<option value="0">(Motif du Rejet)</option>'; 158 159 foreach($rej->motifs as $key => $value) 160 { 161 print '<option value="'.$key.'">'.$value.'</option>'; 162 } 163 print '</select>'; 164 print '</td>'; 165 print '<td class="valid" align="center">'; 166 print '<input type="submit" value="Confirmer"></td></tr>'; 167 168 print '<tr><td class="valid">Facturation du rejet</td>'; 169 print '<td class="valid" colspan="2">'; 170 print '<select name="facturer">'; 171 print '<option value="0">Ne Pas Facturer le rejet</option>'; 172 print '<option value="1">Facturer le rejet au client</option>'; 173 print '</select>'; 174 print '</td>'; 175 print '</table></form>'; 176 } 177 178 $page = $_GET["page"]; 179 $sortorder = $_GET["sortorder"]; 180 $sortfield = $_GET["sortfield"]; 181 182 if ($page == -1) { $page = 0 ; } 183 184 $offset = $conf->liste_limit * $page ; 185 $pageprev = $page - 1; 186 $pagenext = $page + 1; 187 188 if ($sortorder == "") $sortorder="DESC"; 189 if ($sortfield == "") $sortfield="pl.fk_soc"; 190 191 /* 192 * Liste des factures 193 * 194 * 195 */ 196 $sql = "SELECT pf.rowid"; 197 $sql .= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc"; 198 $sql .= " , s.idp, s.nom"; 199 $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; 200 $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; 201 $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf"; 202 $sql .= " , ".MAIN_DB_PREFIX."facture as f"; 203 $sql .= " , ".MAIN_DB_PREFIX."societe as s"; 204 $sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid"; 205 $sql .= " AND pl.fk_prelevement_bons = p.rowid"; 206 $sql .= " AND f.fk_soc = s.idp"; 207 $sql .= " AND pf.fk_facture = f.rowid"; 208 $sql .= " AND pl.rowid=".$_GET["id"]; 209 210 if ($_GET["socid"]) 211 { 212 $sql .= " AND s.idp = ".$_GET["socid"]; 213 } 214 215 $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); 216 217 $result = $db->query($sql); 218 219 if ($result) 220 { 221 $num = $db->num_rows($result); 222 $i = 0; 223 224 $urladd = "&id=".$_GET["id"]; 225 226 print_barre_liste("Factures", $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num); 227 print"\n<!-- debut table -->\n"; 228 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 229 print '<tr class="liste_titre">'; 230 print '<td>Facture</td><td>Société</td>Montant</td>'; 231 print '<td> </td></tr>'; 232 233 $var=True; 234 235 $total = 0; 236 237 while ($i < min($num,$conf->liste_limit)) 238 { 239 $obj = $db->fetch_object($result); 240 241 print "<tr $bc[$var]><td>"; 242 243 print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'; 244 print img_object($langs->trans("ShowBill"),"bill"); 245 print '</a> '; 246 247 print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n"; 248 249 print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->idp.'">'; 250 print img_object($langs->trans("ShowCompany"),"company"). ' '.stripslashes($obj->nom)."</a></td>\n"; 251 252 print '<td align="center">'.price($obj->total_ttc)."</td>\n"; 253 254 255 print "</tr>\n"; 256 257 $i++; 258 } 259 260 print "</table>"; 261 262 $db->free($result); 263 } 264 else 265 { 266 dolibarr_print_error($db); 267 } 268 269 $db->close(); 270 271 272 /* ************************************************************************** */ 273 /* */ 274 /* Barre d'action */ 275 /* */ 276 /* ************************************************************************** */ 277 278 print "\n</div>\n<div class=\"tabsAction\">\n"; 279 280 if ($_GET["action"] == '') 281 { 282 283 if ($bon->credite == 1 && $lipre->statut == 2) 284 { 285 print "<a class=\"tabAction\" href=\"ligne.php?action=rejet&id=$lipre->id\">".$langs->trans("Emmetre un rejet")."</a>"; 286 } 287 } 288 289 print "</div>"; 290 } 291 292 llxFooter('$Date: 2005/11/16 14:43:14 $ - $Revision: 1.10 $'); 293 ?>
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 |
![]() |