[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> 4 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 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: cotisations.php,v 1.25 2005/09/11 01:54:58 eldy Exp $ 21 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/adherents/cotisations.php,v $ 22 */ 23 24 /** 25 \file htdocs/adherents/cotisations.php 26 \ingroup adherent 27 \brief Page de consultation et insertion d'une cotisation 28 \version $Revision: 1.25 $ 29 */ 30 31 require ("./pre.inc.php"); 32 require_once (DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); 33 34 $sortorder=$_GET["sortorder"]; 35 $sortfield=$_GET["sortfield"]; 36 $page=$_GET["page"]; 37 $filter=$_GET["filter"]; 38 $statut=isset($_GET["statut"])?$_GET["statut"]:1; 39 40 if (! $sortorder) { $sortorder="DESC"; } 41 if (! $sortfield) { $sortfield="c.dateadh"; } 42 if ($page == -1) { $page = 0 ; } 43 $offset = $conf->liste_limit * $page ; 44 $pageprev = $page - 1; 45 $pagenext = $page + 1; 46 47 $date_select=isset($_GET["date_select"])?$_GET["date_select"]:$_POST["date_select"]; 48 49 50 51 // Insertion de la cotisation dans le compte banquaire 52 if ($_POST["action"] == '2bank' && $_POST["rowid"] !='') 53 { 54 if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0) 55 { 56 57 // \todo Créer une facture et enregistrer son paiement 58 59 60 $dateop=strftime("%Y%m%d",time()); 61 $sql="SELECT cotisation FROM ".MAIN_DB_PREFIX."cotisation WHERE rowid=".$_POST["rowid"]." "; 62 $result = $db->query($sql); 63 if ($result) 64 { 65 $num = $db->num_rows($result); 66 if ($num>0) 67 { 68 $objp = $db->fetch_object($result); 69 $amount=$objp->cotisation; 70 $acct=new Account($db,ADHERENT_BANK_ACCOUNT); 71 $insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"],ADHERENT_BANK_CATEGORIE,$user); 72 if ($insertid == '') 73 { 74 dolibarr_print_error($db); 75 } 76 else 77 { 78 // met a jour la table cotisation 79 $sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=$insertid WHERE rowid=".$_POST["rowid"]." "; 80 $result = $db->query($sql); 81 if ($result) 82 { 83 //Header("Location: cotisations.php"); 84 } 85 else 86 { 87 dolibarr_print_error($db); 88 } 89 } 90 } 91 else 92 { 93 dolibarr_print_error($db); 94 } 95 } 96 else 97 { 98 dolibarr_print_error($db); 99 } 100 101 } 102 } 103 104 105 106 107 llxHeader(); 108 109 110 $params="&select_date=".$select_date; 111 print_barre_liste($langs->trans("ListOfSubscriptions"), $page, "cotisations.php", $params, $sortfield, $sortorder,'',$num); 112 113 114 // Liste des cotisations 115 $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, b.fk_account,"; 116 $sql.= " c.cotisation, ".$db->pdate("c.dateadh")." as dateadh, c.fk_bank as bank, c.rowid as crowid,"; 117 $sql.= " b.fk_account"; 118 $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; 119 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid"; 120 $sql.= " WHERE d.rowid = c.fk_adherent"; 121 if(isset($date_select) && $date_select != '') 122 { 123 $sql .= " AND dateadh LIKE '$date_select%'"; 124 } 125 $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); 126 127 $result = $db->query($sql); 128 if ($result) 129 { 130 $num = $db->num_rows($result); 131 $i = 0; 132 133 print '<table class="noborder" width="100%">'; 134 135 $param="&page=$page&statut=$statut&date_select=$date_select"; 136 print '<tr class="liste_titre">'; 137 print_liste_field_titre($langs->trans("Date"),"cotisations.php","c.dateadh",$param,"","",$sortfield); 138 print_liste_field_titre($langs->trans("Name"),"cotisations.php","d.nom",$param,"","",$sortfield); 139 print_liste_field_titre($langs->trans("Amount"),"cotisations.php","c.cotisation",$param,"","align=\"right\"",$sortfield); 140 if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0) 141 { 142 print_liste_field_titre($langs->trans("Bank"),"cotisations.php","b.fk_account",$pram,"","",$sortfield); 143 } 144 print "</tr>\n"; 145 146 $var=true; 147 $total=0; 148 while ($i < $num) 149 { 150 $objp = $db->fetch_object($result); 151 $total+=price($objp->cotisation); 152 153 $var=!$var; 154 print "<tr $bc[$var]>"; 155 print "<td>".dolibarr_print_date($objp->dateadh)."</td>\n"; 156 print "<td><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".img_object($langs->trans("ShowMember"),"user").' '.stripslashes($objp->prenom)." ".stripslashes($objp->nom)."</a></td>\n"; 157 print '<td align="right">'.price($objp->cotisation).'</td>'; 158 if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0) 159 { 160 if ($objp->fk_account) 161 { 162 $acc=new Account($db); 163 $acc->fetch($objp->fk_account); 164 print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$objp->fk_account.'">'.$acc->label.'</a></td>'; 165 } 166 else 167 { 168 print "<td>"; 169 print "<form method=\"post\" action=\"cotisations.php\">"; 170 print '<input type="hidden" name="action" value="2bank">'; 171 print '<input type="hidden" name="rowid" value="'.$objp->crowid.'">'; 172 $html = new Form($db); 173 $html->select_types_paiements(); 174 print '<input name="num_chq" type="text" class="flat" size="6"> - '; 175 print "<input name=\"label\" type=\"text\" class=\"flat\" size=\"30\" value=\"".$langs->trans("Subscriptions").' '.stripslashes($objp->prenom)." ".stripslashes($objp->nom)." ".strftime("%Y",$objp->dateadh)."\" >\n"; 176 // print "<td><input name=\"debit\" type=\"text\" size=8></td>"; 177 // print "<td><input name=\"credit\" type=\"text\" size=8></td>"; 178 print '<input type="submit" class="button" value="'.$langs->trans("Save").'">'; 179 print "</form>\n"; 180 print "</td>\n"; 181 } 182 } 183 print "</tr>"; 184 $i++; 185 } 186 187 $var=!$var; 188 print '<tr class="liste_total">'; 189 print "<td>".$langs->trans("Total")."</td>\n"; 190 print "<td align=\"right\"> </td>\n"; 191 print "<td align=\"right\">".price($total)."</td>\n"; 192 print '<td> </td>'; 193 print "</tr>\n"; 194 print "</table>"; 195 print "<br>\n"; 196 197 198 } 199 else 200 { 201 dolibarr_print_error($db); 202 } 203 204 205 $db->close(); 206 207 llxFooter('$Date: 2005/09/11 01:54:58 $ - $Revision: 1.25 $'); 208 ?>
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 |
![]() |