| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-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: recap-client.php,v 1.15 2005/09/05 19:03:02 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/recap-client.php,v $ 21 * 22 */ 23 24 /** 25 \file htdocs/compta/recap-client.php 26 \ingroup compta 27 \brief Page de fiche compta 28 \version $Revision: 1.15 $ 29 */ 30 31 require ("./pre.inc.php"); 32 include_once (DOL_DOCUMENT_ROOT."/facture.class.php"); 33 34 $langs->load("companies"); 35 if ($conf->facture->enabled) $langs->load("bills"); 36 37 /* 38 * Sécurité accés client 39 */ 40 $socid = $_GET["socid"]; 41 if ($user->societe_id > 0) 42 { 43 $action = ''; 44 $socid = $user->societe_id; 45 } 46 47 $user->getrights('facture'); 48 49 llxHeader(); 50 51 52 /* 53 * 54 * Mode fiche 55 * 56 */ 57 if ($socid > 0) 58 { 59 $societe = new Societe($db); 60 $societe->fetch($socid, $to); // si $to='next' ajouter " AND s.idp > $socid ORDER BY idp ASC LIMIT 1"; 61 62 /* 63 * Affichage onglets 64 */ 65 /* 66 * Affichage onglets 67 */ 68 $h = 0; 69 70 $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id; 71 $head[$h][1] = $langs->trans("Company"); 72 $h++; 73 74 if ($societe->client==1) 75 { 76 $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id; 77 $head[$h][1] = $langs->trans("Customer"); 78 $h++; 79 } 80 if ($societe->client==2) 81 { 82 $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$societe->id; 83 $head[$h][1] = $langs->trans("Prospect"); 84 $h++; 85 } 86 if ($societe->fournisseur) 87 { 88 $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; 89 $head[$h][1] = $langs->trans("Supplier"); 90 $h++; 91 } 92 93 if ($conf->compta->enabled) { 94 $langs->load("compta"); 95 $hselected=$h; 96 $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; 97 $head[$h][1] = $langs->trans("Accountancy"); 98 $h++; 99 } 100 101 $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; 102 $head[$h][1] = $langs->trans("Note"); 103 $h++; 104 105 if ($user->societe_id == 0) 106 { 107 $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; 108 $head[$h][1] = $langs->trans("Documents"); 109 $h++; 110 } 111 112 $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; 113 $head[$h][1] = $langs->trans("Notifications"); 114 $h++; 115 116 if ($user->societe_id == 0) 117 { 118 $head[$h][0] = DOL_URL_ROOT."/index.php?socidp=$societe->id&action=add_bookmark"; 119 $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); 120 $head[$h][2] = 'image'; 121 } 122 123 dolibarr_fiche_head($head, $hselected, $societe->nom); 124 125 /* 126 * 127 */ 128 print "<table width=\"100%\">\n"; 129 print '<tr><td valign="top" width="50%">'; 130 131 print '<table class="border" width="100%">'; 132 133 print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>'; 134 135 print '<td>'.$langs->trans("Prefix").'</td><td colspan="3">'; 136 print ($societe->prefix_comm?$societe->prefix_comm:' '); 137 print '</td>'; 138 139 if ($societe->client) { 140 print '<tr>'; 141 print '<td nowrap width="100">'.$langs->trans("CustomerCode"). '</td><td colspan="3">'. $societe->code_client . '</td>'; 142 print '</tr>'; 143 print '<tr>'; 144 print '<td nowrap>'.$langs->trans("CustomerAccountancyCode").'</td><td colspan="3">'.$societe->code_compta.'</td>'; 145 print '</tr>'; 146 } 147 148 if ($societe->fournisseur) { 149 print '<tr>'; 150 print '<td nowrap>'.$langs->trans("SupplierCode"). '</td><td colspan="3">'. $societe->code_fournisseur . '</td>'; 151 print '</tr>'; 152 print '<tr>'; 153 print '<td nowrap>'.$langs->trans("SupplierAccountancyCode").'</td><td colspan="3">'.$societe->code_compta_fournisseur.'</td>'; 154 print '</tr>'; 155 } 156 157 print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->adresse)."</td></tr>"; 158 159 print '<tr><td>'.$langs->trans('Zip').'</td><td>'.$societe->cp.'</td>'; 160 print '<td>'.$langs->trans('Town').'</td><td>'.$societe->ville.'</td></tr>'; 161 162 print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$soc->pays.'</td>'; 163 164 print '<tr><td>'.$langs->trans("Phone").'</td><td>'.dolibarr_print_phone($societe->tel,$societe->pays_code).' </td><td>'.$langs->trans("Fax").'</td><td>'.dolibarr_print_phone($societe->fax,$societe->pays_code).' </td></tr>'; 165 166 print "<tr><td nowrap>".$langs->transcountry("ProfId1",$societe->pays_code)."</td><td><a href=\"http://www.societe.com/cgi-bin/recherche?rncs=".$societe->siren."\">".$societe->siren."</a> </td>"; 167 print '<td>'.$langs->transcountry('ProfId2',$societe->pays_code).'</td><td>'.$societe->siret.'</td></tr>'; 168 169 print '<tr><td>'.$langs->transcountry('ProfId3',$societe->pays_code).'</td><td>'.$societe->ape.'</td><td colspan="2"> </td></tr>'; 170 171 print "</table>"; 172 173 /* 174 * 175 */ 176 print "</td></tr></table>\n"; 177 178 print '</div>'; 179 180 181 if ($conf->facture->enabled && $user->rights->facture->lire) 182 { 183 // Factures 184 print_fiche_titre($langs->trans("Bills")); 185 186 print '<table class="border" width="100%">'; 187 188 $sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df"; 189 $sql .= " , f.paye as paye, f.fk_statut as statut, f.rowid as facid "; 190 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; 191 $sql .= " WHERE f.fk_soc = s.idp AND s.idp = ".$societe->id; 192 $sql .= " ORDER BY f.datef DESC"; 193 194 $resql=$db->query($sql); 195 if ($resql) 196 { 197 $var=true; 198 $num = $db->num_rows($resql); 199 if ($num > 0) 200 { 201 print '<tr class="liste_titre">'; 202 print '<td width="100" align="center">'.$langs->trans("Date").'</td><td> </td>'; 203 print '<td align="right">'.$langs->trans("Debit").'</td>'; 204 print '<td align="right">'.$langs->trans("Credit").'</td>'; 205 print '<td align="right">'.$langs->trans("Balance").'</td>'; 206 print '</tr>'; 207 } 208 else 209 { 210 print $langs->trans("NoBills"); 211 } 212 213 $i = 0; 214 while ($i < $num) 215 { 216 $objp = $db->fetch_object($resql); 217 $facs[$i] = $objp->facid; 218 $i++; 219 } 220 $db->free($resql); 221 222 223 $solde = 0; 224 225 // Boucle sur chaque facture 226 for ($i = 0 ; $i < $num ; $i++) 227 { 228 $fac = new Facture($db); 229 $ret=$fac->fetch($facs[$i]); 230 if ($ret < 0) 231 { 232 print $fac->error."<br>"; 233 continue; 234 } 235 236 $var=!$var; 237 print "<tr $bc[$var]>"; 238 239 print "<td align=\"center\">".dolibarr_print_date($fac->date)."</td>\n"; 240 print "<td><a href=\"../compta/facture.php?facid=$fac->id\">".img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref."</a></td>\n"; 241 242 print '<td align="right">'.price($fac->total_ttc)."</td>\n"; 243 $solde = $solde + $fac->total_ttc; 244 245 print '<td align="right"> </td>'; 246 print '<td align="right">'.price($solde)."</td>\n"; 247 print "</tr>\n"; 248 249 // Paiements 250 $sql = "SELECT p.rowid,".$db->pdate("p.datep")." as dp, pf.amount, p.statut"; 251 252 $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p"; 253 $sql .= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; 254 $sql .= " WHERE pf.fk_paiement = p.rowid"; 255 $sql .= " AND pf.fk_facture = ".$fac->id; 256 257 $resql = $db->query($sql); 258 if ($resql) 259 { 260 $nump = $db->num_rows($resql); 261 $j = 0; 262 263 while ($j < $nump) 264 { 265 $objp = $db->fetch_object($resql); 266 //$var=!$var; 267 print "<tr $bc[$var]>"; 268 print '<td align="center">'.dolibarr_print_date($objp->dp)."</td>\n"; 269 print '<td>'; 270 print ' '; // Décalage 271 print '<a href="paiement/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.'</td>'; 272 print "<td> </td>\n"; 273 print '<td align="right">'.price($objp->amount).'</td>'; 274 $solde = $solde - $objp->amount; 275 print '<td align="right">'.price($solde)."</td>\n"; 276 print '</tr>'; 277 278 $j++; 279 } 280 } 281 } 282 } 283 else 284 { 285 dolibarr_print_error($db); 286 } 287 print "</table>"; 288 } 289 } 290 else 291 { 292 print "Erreur"; 293 } 294 295 296 $db->close(); 297 298 llxFooter('$Date: 2005/09/05 19:03:02 $ - $Revision: 1.15 $'); 299 ?>
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 |
|