[ 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: create.php,v 1.5 2005/12/08 23:53:43 eldy Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/prelevement/create.php,v $ 20 */ 21 22 /** 23 \file htdocs/compta/prelevement/create.php 24 \brief Prelevement 25 \version $Revision: 1.5 $ 26 */ 27 28 require ("./pre.inc.php"); 29 require_once(DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php"); 30 31 if (!$user->rights->prelevement->bons->creer) 32 accessforbidden(); 33 34 35 /* 36 * Actions 37 */ 38 39 if ($_GET["action"] == 'create') 40 { 41 $bprev = new BonPrelevement($db); 42 $result=$bprev->create($_GET["banque"],$_GET["guichet"]); 43 if ($result < 0) 44 { 45 $mesg='<div class="error">'.$bprev->error.'</div>'; 46 } 47 if ($result == 0) 48 { 49 $mesg='<div class="error">Aucune facture prélevable, prélevé avec succès</div>'; 50 } 51 } 52 53 54 llxHeader(); 55 56 $h=0; 57 $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php'; 58 $head[$h][1] = $langs->trans("NewStandingOrder"); 59 $h++; 60 61 dolibarr_fiche_head($head, $hselected, $langs->trans("StandingOrders")); 62 63 $bprev = new BonPrelevement($db); 64 65 $nb=$bprev->NbFactureAPrelever(); 66 $nb1=$bprev->NbFactureAPrelever(1); 67 $nb11=$bprev->NbFactureAPrelever(1,1); 68 if ($nb < 0 || $nb1 < 0 || $nb11 < 0) 69 { 70 dolibarr_print_error($bprev->error); 71 } 72 print '<table class="border" width="100%">'; 73 print '<tr><td>Nb de facture à prélever :</td>'; 74 print '<td align="right">'; 75 print $nb; 76 print '</td><td>Notre banque :</td><td align="right">'; 77 print $nb1; 78 print '</td><td>Notre agence :</td><td align="right">'; 79 print $nb11; 80 print '</td></tr>'; 81 82 print '<tr><td>Somme à prélever</td>'; 83 print '<td align="right">'; 84 print price($bprev->SommeAPrelever()); 85 print '</td>'; 86 print '<td colspan="4"> </td>'; 87 88 print '</tr></table>'; 89 90 print '</div>'; 91 92 if ($mesg) print $mesg; 93 94 if ($nb) 95 { 96 print "<div class=\"tabsAction\">\n"; 97 98 if ($nb) print '<a class="tabAction" href="create.php?action=create">'.$langs->trans("Create")."</a>\n"; 99 if ($nb1) print '<a class="tabAction" href="create.php?action=create&banque=1&guichet=1">'.$langs->trans("CreateGuichet")."</a>\n"; 100 if ($nb11) print '<a class="tabAction" href="create.php?action=create&banque=1">'.$langs->trans("CreateBanque")."</a>\n"; 101 102 print "</div>\n"; 103 } 104 else 105 { 106 print "Aucune facture en mode de paiement 'Prélevement' n'a de demande de prélèvements en attente.<br>"; 107 } 108 print '<br>'; 109 110 111 /* 112 * Liste des derniers bons 113 * 114 */ 115 $limit=5; 116 117 $sql = "SELECT p.rowid, p.ref, p.amount,".$db->pdate("p.datec")." as datec"; 118 $sql.= ", p.statut"; 119 $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; 120 $sql.= " ORDER BY datec DESC"; 121 $sql.=$db->plimit($limit); 122 123 $result = $db->query($sql); 124 if ($result) 125 { 126 $num = $db->num_rows($result); 127 $i = 0; 128 129 print"\n<!-- debut table -->\n"; 130 print '<table class="noborder" width="100%">'; 131 print '<tr class="liste_titre"><td>'.$langs->trans("LastWithdrawalReceipts",$limit).'</td>'; 132 print '<td><Date</td><td align="right">'.$langs->trans("Amount").'</td>'; 133 print '</tr>'; 134 135 $var=True; 136 137 while ($i < min($num,$limit)) 138 { 139 $obj = $db->fetch_object($result); 140 $var=!$var; 141 142 print "<tr $bc[$var]><td>"; 143 print '<img border="0" src="./statut'.$obj->statut.'.png"></a> '; 144 print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n"; 145 print '<td align="center">'.strftime("%d/%m/%Y",$obj->datec)."</td>\n"; 146 147 print '<td align="right">'.price($obj->amount).' '.$langs->trans("Currency".$conf->monnaie)."</td>\n"; 148 149 print "</tr>\n"; 150 $i++; 151 } 152 print "</table><br>"; 153 $db->free($result); 154 } 155 else 156 { 157 dolibarr_print_error($db); 158 } 159 160 161 162 /* 163 * Factures en attente de prélèvement 164 * 165 */ 166 $sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp"; 167 $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; 168 $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; 169 $sql .= " WHERE s.idp = f.fk_soc"; 170 $sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid"; 171 172 if ($socidp) 173 { 174 $sql .= " AND f.fk_soc = $socidp"; 175 } 176 177 if ( $db->query($sql) ) 178 { 179 $num = $db->num_rows(); 180 $i = 0; 181 182 if ($num) 183 { 184 print '<table class="noborder" width="100%">'; 185 print '<tr class="liste_titre">'; 186 print '<td colspan="2">Factures en attente de prélèvement ('.$num.')</td></tr>'; 187 $var = True; 188 while ($i < $num && $i < 20) 189 { 190 $obj = $db->fetch_object(); 191 $var=!$var; 192 print '<tr '.$bc[$var].'><td>'; 193 print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().' '.$obj->facnumber.'</a></td>'; 194 print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$obj->nom.'</a></td>'; 195 print '</tr>'; 196 $i++; 197 } 198 199 print "</table><br>"; 200 201 } 202 } 203 else 204 { 205 dolibarr_print_error($db); 206 } 207 208 209 llxFooter('$Date: 2005/12/08 23:53:43 $ - $Revision: 1.5 $'); 210 ?>
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 |
![]() |