dolibarr  7.0.0-beta
index.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
5  * Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
6  * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
7  * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
29 require '../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
32 
33 $langs->loadLangs(array('compta','bills','donation','salaries'));
34 
35 $date_startmonth=GETPOST('date_startmonth','int');
36 $date_startday=GETPOST('date_startday','int');
37 $date_startyear=GETPOST('date_startyear','int');
38 $date_endmonth=GETPOST('date_endmonth','int');
39 $date_endday=GETPOST('date_endday','int');
40 $date_endyear=GETPOST('date_endyear','int');
41 
42 $nbofyear=4;
43 
44 // Date range
45 $year=GETPOST('year','int');
46 if (empty($year))
47 {
48  $year_current = strftime("%Y",dol_now());
49  $month_current = strftime("%m",dol_now());
50  $year_start = $year_current - ($nbofyear - 1);
51 } else {
52  $year_current = $year;
53  $month_current = strftime("%m",dol_now());
54  $year_start = $year - ($nbofyear - 1);
55 }
56 $date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
57 $date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
58 
59 // We define date_start and date_end
60 if (empty($date_start) || empty($date_end)) // We define date_start and date_end
61 {
62  $q=GETPOST("q")?GETPOST("q"):0;
63  if ($q==0)
64  {
65  // We define date_start and date_end
66  $year_end=$year_start + ($nbofyear - 1);
67  $month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
68  if (! GETPOST('month'))
69  {
70  if (! GETPOST("year") && $month_start > $month_current)
71  {
72  $year_start--;
73  $year_end--;
74  }
75  $month_end=$month_start-1;
76  if ($month_end < 1) $month_end=12;
77  else $year_end++;
78  }
79  else $month_end=$month_start;
80  $date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
81  }
82  if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
83  if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
84  if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
85  if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
86 }
87 
88 // $date_start and $date_end are defined. We force $start_year and $nbofyear
89 $tmps=dol_getdate($date_start);
90 $start_year = $tmps['year'];
91 $tmpe=dol_getdate($date_end);
92 $year_end = $tmpe['year'];
93 $nbofyear = ($year_end - $start_year) + 1;
94 //var_dump($start_year." ".$end_year." ".$nbofyear);
95 
96 // Security check
97 $socid = GETPOST('socid','int');
98 if ($user->societe_id > 0) $socid = $user->societe_id;
99 if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat');
100 if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport');
101 
102 // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
103 $modecompta = $conf->global->ACCOUNTING_MODE;
104 if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
105 if (GETPOST("modecompta",'alpha')) $modecompta=GETPOST("modecompta",'alpha');
106 
107 
108 /*
109  * View
110  */
111 
112 llxHeader();
113 
114 $form=new Form($db);
115 
116 $exportlink='';
117 
118 // Affiche en-tete du rapport
119 if ($modecompta == 'CREANCES-DETTES')
120 {
121  $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear");
122  $calcmode=$langs->trans("CalcModeDebt");
123  $calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
124  $calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
125  $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
126  $periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
127  $description=$langs->trans("RulesAmountWithTaxIncluded");
128  $description.='<br>'.$langs->trans("RulesResultDue");
129  if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.="<br>".$langs->trans("DepositsAreNotIncluded");
130  else $description.="<br>".$langs->trans("DepositsAreIncluded");
131  $builddate=dol_now();
132  //$exportlink=$langs->trans("NotYetAvailable");
133 }
134 else if ($modecompta=="RECETTES-DEPENSES") {
135  $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear");
136  $calcmode=$langs->trans("CalcModeEngagement");
137  $calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
138  $calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
139  $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
140  $periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
141  $description=$langs->trans("RulesAmountWithTaxIncluded");
142  $description.='<br>'.$langs->trans("RulesResultInOut");
143  $builddate=dol_now();
144  //$exportlink=$langs->trans("NotYetAvailable");
145 }
146 else if ($modecompta=="BOOKKEEPING")
147 {
148  $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear");
149  $calcmode=$langs->trans("CalcModeBookkeeping");
150  $calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
151  $calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
152  $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
153  $periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
154  $description=$langs->trans("RulesAmountOnInOutBookkeepingRecord");
155  $description.=' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("Chartofaccounts")).')';
156  $builddate=dol_now();
157  //$exportlink=$langs->trans("NotYetAvailable");
158 }
159 
160 $hselected='report';
161 
162 report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
163 
164 if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
165 {
166  print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
167 }
168 
169 
170 
171 /*
172  * Factures clients
173  */
174 
175 $subtotal_ht = 0;
176 $subtotal_ttc = 0;
177 if (! empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
178 {
179  if ($modecompta == 'CREANCES-DETTES')
180  {
181  $sql = "SELECT sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
182  $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
183  $sql.= ", ".MAIN_DB_PREFIX."facture as f";
184  $sql.= " WHERE f.fk_soc = s.rowid";
185  $sql.= " AND f.fk_statut IN (1,2)";
186  if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
187  else $sql.= " AND f.type IN (0,1,2,3,5)";
188  if (! empty($date_start) && ! empty($date_end))
189  $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
190  }
191  else if ($modecompta=="RECETTES-DEPENSES")
192  {
193  /*
194  * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
195  * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
196  */
197  $sql = "SELECT sum(pf.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
198  $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
199  $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf";
200  $sql.= ", ".MAIN_DB_PREFIX."paiement as p";
201  $sql.= " WHERE p.rowid = pf.fk_paiement";
202  $sql.= " AND pf.fk_facture = f.rowid";
203  if (! empty($date_start) && ! empty($date_end))
204  $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
205  }
206 
207  $sql.= " AND f.entity = ".$conf->entity;
208  if ($socid) $sql.= " AND f.fk_soc = $socid";
209  $sql.= " GROUP BY dm";
210  $sql.= " ORDER BY dm";
211 
212  //print $sql;
213  dol_syslog("get customers invoices", LOG_DEBUG);
214  $result=$db->query($sql);
215  if ($result)
216  {
217  $num = $db->num_rows($result);
218  $i = 0;
219  while ($i < $num)
220  {
221  $row = $db->fetch_object($result);
222  $encaiss[$row->dm] = (isset($row->amount_ht)?$row->amount_ht:0);
223  $encaiss_ttc[$row->dm] = $row->amount_ttc;
224  $i++;
225  }
226  $db->free($result);
227  }
228  else {
229  dol_print_error($db);
230  }
231 }
232 else if ($modecompta=="BOOKKEEPING")
233 {
234  // Nothing from this table
235 }
236 
237 if (! empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
238 {
239  // On ajoute les paiements clients anciennes version, non lies par paiement_facture
240  if ($modecompta != 'CREANCES-DETTES')
241  {
242  $sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
243  $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
244  $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
245  $sql.= ", ".MAIN_DB_PREFIX."paiement as p";
246  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
247  $sql.= " WHERE pf.rowid IS NULL";
248  $sql.= " AND p.fk_bank = b.rowid";
249  $sql.= " AND b.fk_account = ba.rowid";
250  $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
251  if (! empty($date_start) && ! empty($date_end))
252  $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
253  $sql.= " GROUP BY dm";
254  $sql.= " ORDER BY dm";
255 
256  dol_syslog("get old customers payments not linked to invoices", LOG_DEBUG);
257  $result = $db->query($sql);
258  if ($result) {
259  $num = $db->num_rows($result);
260  $i = 0;
261  while ($i < $num)
262  {
263  $row = $db->fetch_object($result);
264 
265  if (! isset($encaiss[$row->dm])) $encaiss[$row->dm]=0;
266  $encaiss[$row->dm] += (isset($row->amount_ht)?$row->amount_ht:0);
267 
268  if (! isset($encaiss_ttc[$row->dm])) $encaiss_ttc[$row->dm]=0;
269  $encaiss_ttc[$row->dm] += $row->amount_ttc;
270 
271  $i++;
272  }
273  }
274  else {
275  dol_print_error($db);
276  }
277  }
278  else if ($modecompta=="RECETTES-DEPENSES")
279  {
280  // Nothing from this table
281  }
282 }
283 else if ($modecompta=="BOOKKEEPING")
284 {
285  // Nothing from this table
286 }
287 
288 
289 /*
290  * Frais, factures fournisseurs.
291  */
292 $subtotal_ht = 0;
293 $subtotal_ttc = 0;
294 
295 if (! empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
296 {
297  if ($modecompta == 'CREANCES-DETTES')
298  {
299  $sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
300  $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
301  $sql.= " WHERE f.fk_statut IN (1,2)";
302  if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
303  else $sql.= " AND f.type IN (0,1,2,3)";
304  if (! empty($date_start) && ! empty($date_end))
305  $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
306  }
307  else if ($modecompta=="RECETTES-DEPENSES")
308  {
309  $sql = "SELECT sum(pf.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
310  $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
311  $sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
312  $sql.= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
313  $sql.= " WHERE f.rowid = pf.fk_facturefourn";
314  $sql.= " AND p.rowid = pf.fk_paiementfourn";
315  if (! empty($date_start) && ! empty($date_end))
316  $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
317  }
318 
319  $sql.= " AND f.entity = ".$conf->entity;
320  if ($socid) $sql.= " AND f.fk_soc = ".$socid;
321  $sql.= " GROUP BY dm";
322 
323  dol_syslog("get suppliers invoices", LOG_DEBUG);
324  $result=$db->query($sql);
325  if ($result)
326  {
327  $num = $db->num_rows($result);
328  $i = 0;
329  while ($i < $num)
330  {
331  $row = $db->fetch_object($result);
332 
333  if (! isset($decaiss[$row->dm])) $decaiss[$row->dm]=0;
334  $decaiss[$row->dm] = (isset($row->amount_ht)?$row->amount_ht:0);
335 
336  if (! isset($decaiss_ttc[$row->dm])) $decaiss_ttc[$row->dm]=0;
337  $decaiss_ttc[$row->dm] = $row->amount_ttc;
338 
339  $i++;
340  }
341  $db->free($result);
342  }
343  else {
344  dol_print_error($db);
345  }
346 }
347 else if ($modecompta=="BOOKKEEPING")
348 {
349  // Nothing from this table
350 }
351 
352 
353 
354 /*
355  * TVA
356  */
357 
358 $subtotal_ht = 0;
359 $subtotal_ttc = 0;
360 if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
361 {
362  if ($modecompta == 'CREANCES-DETTES')
363  {
364  // TVA a payer
365  $sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm";
366  $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
367  $sql.= " WHERE f.fk_statut IN (1,2)";
368  if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
369  else $sql.= " AND f.type IN (0,1,2,3,5)";
370  $sql.= " AND f.entity = ".$conf->entity;
371  if (! empty($date_start) && ! empty($date_end))
372  $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
373  $sql.= " GROUP BY dm";
374 
375  dol_syslog("get vat to pay", LOG_DEBUG);
376  $result=$db->query($sql);
377  if ($result) {
378  $num = $db->num_rows($result);
379  $var=false;
380  $i = 0;
381  if ($num) {
382  while ($i < $num) {
383  $obj = $db->fetch_object($result);
384 
385  if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
386  $decaiss[$obj->dm] += $obj->amount;
387 
388  if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
389  $decaiss_ttc[$obj->dm] += $obj->amount;
390 
391  $i++;
392  }
393  }
394  } else {
395  dol_print_error($db);
396  }
397  // TVA a recuperer
398  $sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm";
399  $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
400  $sql.= " WHERE f.fk_statut IN (1,2)";
401  if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
402  else $sql.= " AND f.type IN (0,1,2,3)";
403  $sql.= " AND f.entity = ".$conf->entity;
404  if (! empty($date_start) && ! empty($date_end))
405  $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
406  $sql.= " GROUP BY dm";
407 
408  dol_syslog("get vat to receive back", LOG_DEBUG);
409  $result=$db->query($sql);
410  if ($result) {
411  $num = $db->num_rows($result);
412  $var=false;
413  $i = 0;
414  if ($num) {
415  while ($i < $num) {
416  $obj = $db->fetch_object($result);
417 
418  if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
419  $encaiss[$obj->dm] += $obj->amount;
420 
421  if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
422  $encaiss_ttc[$obj->dm] += $obj->amount;
423 
424  $i++;
425  }
426  }
427  } else {
428  dol_print_error($db);
429  }
430  }
431  else if ($modecompta=="RECETTES-DEPENSES")
432  {
433  // TVA reellement deja payee
434  $sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
435  $sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
436  $sql.= " WHERE amount > 0";
437  $sql.= " AND t.entity = ".$conf->entity;
438  if (! empty($date_start) && ! empty($date_end))
439  $sql.= " AND t.datev >= '".$db->idate($date_start)."' AND t.datev <= '".$db->idate($date_end)."'";
440  $sql.= " GROUP BY dm";
441 
442  dol_syslog("get vat really paid", LOG_DEBUG);
443  $result=$db->query($sql);
444  if ($result) {
445  $num = $db->num_rows($result);
446  $var=false;
447  $i = 0;
448  if ($num) {
449  while ($i < $num) {
450  $obj = $db->fetch_object($result);
451 
452  if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
453  $decaiss[$obj->dm] += $obj->amount;
454 
455  if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
456  $decaiss_ttc[$obj->dm] += $obj->amount;
457 
458  $i++;
459  }
460  }
461  } else {
462  dol_print_error($db);
463  }
464  // TVA recuperee
465  $sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
466  $sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
467  $sql.= " WHERE amount < 0";
468  $sql.= " AND t.entity = ".$conf->entity;
469  if (! empty($date_start) && ! empty($date_end))
470  $sql.= " AND t.datev >= '".$db->idate($date_start)."' AND t.datev <= '".$db->idate($date_end)."'";
471  $sql.= " GROUP BY dm";
472 
473  dol_syslog("get vat really received back", LOG_DEBUG);
474  $result=$db->query($sql);
475  if ($result) {
476  $num = $db->num_rows($result);
477  $var=false;
478  $i = 0;
479  if ($num) {
480  while ($i < $num) {
481  $obj = $db->fetch_object($result);
482 
483  if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
484  $encaiss[$obj->dm] += $obj->amount;
485 
486  if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
487  $encaiss_ttc[$obj->dm] += $obj->amount;
488 
489  $i++;
490  }
491  }
492  } else {
493  dol_print_error($db);
494  }
495  }
496 }
497 else if ($modecompta=="BOOKKEEPING")
498 {
499  // Nothing from this table
500 }
501 
502 /*
503  * Charges sociales non deductibles
504  */
505 
506 $subtotal_ht = 0;
507 $subtotal_ttc = 0;
508 if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
509 {
510  if ($modecompta == 'CREANCES-DETTES')
511  {
512  $sql = "SELECT c.libelle as nom, date_format(cs.date_ech,'%Y-%m') as dm, sum(cs.amount) as amount";
513  $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
514  $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
515  $sql.= " WHERE cs.fk_type = c.id";
516  $sql.= " AND c.deductible = 0";
517  if (! empty($date_start) && ! empty($date_end))
518  $sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
519  }
520  else if ($modecompta=="RECETTES-DEPENSES")
521  {
522  $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
523  $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
524  $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
525  $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
526  $sql.= " WHERE p.fk_charge = cs.rowid";
527  $sql.= " AND cs.fk_type = c.id";
528  $sql.= " AND c.deductible = 0";
529  if (! empty($date_start) && ! empty($date_end))
530  $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
531  }
532 
533  $sql.= " AND cs.entity = ".$conf->entity;
534  $sql.= " GROUP BY c.libelle, dm";
535 
536  dol_syslog("get social contributions deductible=0 ", LOG_DEBUG);
537  $result=$db->query($sql);
538  if ($result) {
539  $num = $db->num_rows($result);
540  $var=false;
541  $i = 0;
542  if ($num) {
543  while ($i < $num) {
544  $obj = $db->fetch_object($result);
545 
546  if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
547  $decaiss[$obj->dm] += $obj->amount;
548 
549  if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
550  $decaiss_ttc[$obj->dm] += $obj->amount;
551 
552  $i++;
553  }
554  }
555  } else {
556  dol_print_error($db);
557  }
558 }
559 else if ($modecompta=="BOOKKEEPING")
560 {
561  // Nothing from this table
562 }
563 
564 
565 /*
566  * Charges sociales deductibles
567  */
568 
569 $subtotal_ht = 0;
570 $subtotal_ttc = 0;
571 if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
572 {
573  if ($modecompta == 'CREANCES-DETTES')
574  {
575  $sql = "SELECT c.libelle as nom, date_format(cs.date_ech,'%Y-%m') as dm, sum(cs.amount) as amount";
576  $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
577  $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
578  $sql.= " WHERE cs.fk_type = c.id";
579  $sql.= " AND c.deductible = 1";
580  if (! empty($date_start) && ! empty($date_end))
581  $sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
582  }
583  else if ($modecompta=="RECETTES-DEPENSES")
584  {
585  $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
586  $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
587  $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
588  $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
589  $sql.= " WHERE p.fk_charge = cs.rowid";
590  $sql.= " AND cs.fk_type = c.id";
591  $sql.= " AND c.deductible = 1";
592  if (! empty($date_start) && ! empty($date_end))
593  $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
594  }
595 
596  $sql.= " AND cs.entity = ".$conf->entity;
597  $sql.= " GROUP BY c.libelle, dm";
598 
599  dol_syslog("get social contributions paid deductible=1", LOG_DEBUG);
600  $result=$db->query($sql);
601  if ($result) {
602  $num = $db->num_rows($result);
603  $var=false;
604  $i = 0;
605  if ($num) {
606  while ($i < $num) {
607  $obj = $db->fetch_object($result);
608 
609  if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
610  $decaiss[$obj->dm] += $obj->amount;
611 
612  if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
613  $decaiss_ttc[$obj->dm] += $obj->amount;
614 
615  $i++;
616  }
617  }
618  } else {
619  dol_print_error($db);
620  }
621 }
622 else if ($modecompta=="BOOKKEEPING")
623 {
624  // Nothing from this table
625 }
626 
627 
628 /*
629  * Salaries
630  */
631 
632 if (! empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
633 {
634  if ($modecompta == 'CREANCES-DETTES') $column = 'p.datev';
635  if ($modecompta == "RECETTES-DEPENSES") $column = 'p.datep';
636 
637  $subtotal_ht = 0;
638  $subtotal_ttc = 0;
639  $sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount";
640  $sql .= " FROM " . MAIN_DB_PREFIX . "payment_salary as p";
641  $sql .= " WHERE p.entity = " . $conf->entity;
642  if (! empty($date_start) && ! empty($date_end))
643  $sql.= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
644  $sql .= " GROUP BY p.label, dm";
645 
646  dol_syslog("get social salaries payments");
647  $result = $db->query($sql);
648  if ($result) {
649  $num = $db->num_rows($result);
650  $var = false;
651  $i = 0;
652  if ($num) {
653  while ($i < $num) {
654  $obj = $db->fetch_object($result);
655 
656  if (! isset($decaiss[$obj->dm]))
657  $decaiss[$obj->dm] = 0;
658  $decaiss[$obj->dm] += $obj->amount;
659 
660  if (! isset($decaiss_ttc[$obj->dm]))
661  $decaiss_ttc[$obj->dm] = 0;
662  $decaiss_ttc[$obj->dm] += $obj->amount;
663 
664  $i ++;
665  }
666  }
667  } else {
668  dol_print_error($db);
669  }
670 }
671 elseif ($modecompta == "BOOKKEEPING")
672 {
673  // Nothing from this table
674 }
675 
676 
677 /*
678  * Expense reports
679  */
680 
681 if (! empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
682 {
683  $langs->load('trips');
684 
685  if ($modecompta == 'CREANCES-DETTES') {
686  $sql = "SELECT date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
687  $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
688  $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
689  $sql.= " WHERE p.entity = ".getEntity('expensereport');
690  $sql.= " AND p.fk_statut>=5";
691 
692  $column='p.date_valid';
693  if (! empty($date_start) && ! empty($date_end))
694  $sql.= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
695 
696  } elseif ($modecompta == 'RECETTES-DEPENSES') {
697  $sql = "SELECT date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
698  $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
699  $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
700  $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
701  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")";
702  $sql.= " WHERE p.entity = ".getEntity('expensereport');
703  $sql.= " AND p.fk_statut>=5";
704 
705  $column='pe.datep';
706  if (! empty($date_start) && ! empty($date_end))
707  $sql.= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
708  }
709 
710  $sql.= " GROUP BY dm";
711 
712  dol_syslog("get expense report outcome");
713  $result=$db->query($sql);
714  $subtotal_ht = 0;
715  $subtotal_ttc = 0;
716  if ($result)
717  {
718  $num = $db->num_rows($result);
719  if ($num)
720  {
721  while ($obj = $db->fetch_object($result))
722  {
723  if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
724  $decaiss[$obj->dm] += $obj->amount_ht;
725 
726  if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
727  $decaiss_ttc[$obj->dm] += $obj->amount_ttc;
728 
729  }
730  }
731  }
732  else
733  {
734  dol_print_error($db);
735  }
736 
737 }
738 elseif ($modecompta == 'BOOKKEEPING') {
739  // Nothing from this table
740 }
741 
742 
743 /*
744  * Donation get dunning paiement
745  */
746 
747 if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta=="RECETTES-DEPENSES"))
748 {
749  $subtotal_ht = 0;
750  $subtotal_ttc = 0;
751 
752  if ($modecompta == 'CREANCES-DETTES') {
753  $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
754  $sql.= " FROM ".MAIN_DB_PREFIX."don as p";
755  $sql.= " WHERE p.entity = ".$conf->entity;
756  $sql.= " AND fk_statut in (1,2)";
757  if (! empty($date_start) && ! empty($date_end))
758  $sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
759  }
760  elseif ($modecompta == 'RECETTES-DEPENSES') {
761  $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount";
762  $sql.= " FROM ".MAIN_DB_PREFIX."don as p";
763  $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
764  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")";
765  $sql.= " WHERE p.entity IN (".getEntity('donation').")";
766  $sql.= " AND fk_statut >= 2";
767  if (! empty($date_start) && ! empty($date_end))
768  $sql.= " AND pe.datep >= '".$db->idate($date_start)."' AND pe.datep <= '".$db->idate($date_end)."'";
769  }
770 
771  $sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";
772 
773  dol_syslog("get donation payments");
774  $result=$db->query($sql);
775  if ($result)
776  {
777  $num = $db->num_rows($result);
778  $var=false;
779  $i = 0;
780  if ($num)
781  {
782  while ($i < $num)
783  {
784  $obj = $db->fetch_object($result);
785 
786  if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
787  $encaiss[$obj->dm] += $obj->amount;
788 
789  if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
790  $encaiss_ttc[$obj->dm] += $obj->amount;
791 
792  $i++;
793  }
794  }
795  }
796  else
797  {
798  dol_print_error($db);
799  }
800 }
801 elseif ($modecompta == 'BOOKKEEPING') {
802  // Nothing from this table
803 }
804 
805 
806 
807 /*
808  * Request in mode BOOKKEEPING
809  */
810 
811 if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING'))
812 {
813  $subtotal_ht = 0;
814  $subtotal_ttc = 0;
815 
816  $sql = "SELECT b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, pcg_type, date_format(b.doc_date,'%Y-%m') as dm, sum(b.debit) as debit, sum(b.credit) as credit, sum(b.montant) as amount";
817  $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_account as aa";
818  $sql.= " WHERE b.numero_compte = aa.account_number AND b.entity = ".$conf->entity;
819  //$sql.= " AND fk_statut in (1,2)";
820  $sql.= " AND (";
821  //$sql.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))";
822  $sql.= " (pcg_type = 'EXPENSE')";
823  $sql.= " OR ";
824  //$sql.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))";
825  $sql.= " (pcg_type = 'INCOME')";
826  $sql.= ")";
827  //$sql.= " AND code_journal in ('VT', 'AC')";
828  if (! empty($date_start) && ! empty($date_end))
829  $sql.= " AND b.doc_date >= '".$db->idate($date_start)."' AND b.doc_date <= '".$db->idate($date_end)."'";
830  $sql.= " GROUP BY b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, pcg_type, dm";
831 
832  //print $sql;
833 
834  dol_syslog("get bookkeeping record");
835  $result=$db->query($sql);
836  if ($result)
837  {
838  $num = $db->num_rows($result);
839  $var=false;
840  $i = 0;
841  if ($num)
842  {
843  while ($i < $num)
844  {
845  $obj = $db->fetch_object($result);
846 
847  if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
848  $encaiss[$obj->dm] += $obj->debit;
849 
850  if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
851  $encaiss_ttc[$obj->dm] += $obj->credit;
852 
853  $i++;
854  }
855  }
856  }
857  else
858  {
859  dol_print_error($db);
860  }
861 }
862 
863 
864 
865 $action = "balance";
866 $object = array(&$encaiss, &$encaiss_ttc, &$decaiss, &$decaiss_ttc);
867 $parameters["mode"] = $modecompta;
868 // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
869 $hookmanager->initHooks(array('externalbalance'));
870 $reshook=$hookmanager->executeHooks('addReportInfo',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
871 
872 
873 
874 /*
875  * Show result array
876  */
877 
878 $totentrees=array();
879 $totsorties=array();
880 
881 print '<div class="div-table-responsive">';
882 print '<table class="tagtable liste">'."\n";
883 
884 print '<tr class="liste_titre"><td class="liste_titre">&nbsp;</td>';
885 
886 for ($annee = $year_start ; $annee <= $year_end ; $annee++)
887 {
888  print '<td align="center" colspan="2" class="liste_titre borderrightlight">';
889  print '<a href="clientfourn.php?year='.$annee.'">';
890  print $annee;
891  if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1);
892  print '</a></td>';
893 }
894 print '</tr>';
895 print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
896 // Loop on each year to ouput
897 for ($annee = $year_start ; $annee <= $year_end ; $annee++)
898 {
899  print '<td class="liste_titre" align="center">';
900  $htmlhelp='';
901  // if ($modecompta == 'RECETTES-DEPENSES') $htmlhelp=$langs->trans("PurchasesPlusVATEarnedAndDue");
902  print $form->textwithpicto($langs->trans("Outcome"), $htmlhelp);
903  print '</td>';
904  print '<td class="liste_titre" align="center" class="borderrightlight">';
905  $htmlhelp='';
906  // if ($modecompta == 'RECETTES-DEPENSES') $htmlhelp=$langs->trans("SalesPlusVATToRetreive");
907  print $form->textwithpicto($langs->trans("Income"), $htmlhelp);
908  print '</td>';
909 }
910 print '</tr>';
911 
912 $var=True;
913 
914 // Loop on each month
915 $nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0;
916 for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
917 {
918  $mois_modulo = $mois;
919  if($mois>12) {$mois_modulo = $mois-12;}
920 
921  print '<tr class="oddeven">';
922  print "<td>".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,$annee),"%B")."</td>";
923  for ($annee = $year_start ; $annee <= $year_end ; $annee++)
924  {
925  $annee_decalage=$annee;
926  if($mois>12) {$annee_decalage=$annee+1;}
927  $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois_modulo,1,$annee_decalage));
928 
929  print '<td align="right">&nbsp;';
930  if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0)
931  {
932  print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price(price2num($decaiss_ttc[$case],'MT')).'</a>';
933  if (! isset($totsorties[$annee])) $totsorties[$annee]=0;
934  $totsorties[$annee]+=$decaiss_ttc[$case];
935  }
936  print "</td>";
937 
938  print '<td align="right" class="borderrightlight">&nbsp;';
939  //if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0)
940  if (isset($encaiss_ttc[$case]))
941  {
942  print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price(price2num($encaiss_ttc[$case],'MT')).'</a>';
943  if (! isset($totentrees[$annee])) $totentrees[$annee]=0;
944  $totentrees[$annee]+=$encaiss_ttc[$case];
945  }
946  print "</td>";
947  }
948 
949  print '</tr>';
950 }
951 
952 // Total
953 
954 $nbcols=0;
955 print '<tr class="liste_total impair"><td>'.$langs->trans("TotalTTC").'</td>';
956 for ($annee = $year_start ; $annee <= $year_end ; $annee++)
957 {
958  $nbcols+=2;
959  print '<td align="right">'.(isset($totsorties[$annee])?price(price2num($totsorties[$annee],'MT')):'&nbsp;').'</td>';
960  print '<td align="right" style="border-right: 1px solid #DDD">'.(isset($totentrees[$annee])?price(price2num($totentrees[$annee],'MT')):'&nbsp;').'</td>';
961 }
962 print "</tr>\n";
963 
964 // Empty line
965 print '<tr class="impair"><td>&nbsp;</td>';
966 print '<td colspan="'.$nbcols.'">&nbsp;</td>';
967 print "</tr>\n";
968 
969 // Balance
970 
971 print '<tr class="liste_total"><td>'.$langs->trans("AccountingResult").'</td>';
972 for ($annee = $year_start ; $annee <= $year_end ; $annee++)
973 {
974  print '<td align="right" colspan="2" class="borderrightlight"> ';
975  if (isset($totentrees[$annee]) || isset($totsorties[$annee]))
976  {
977  $in=(isset($totentrees[$annee])?price2num($totentrees[$annee], 'MT'):0);
978  $out=(isset($totsorties[$annee])?price2num($totsorties[$annee],'MT'):0);
979  print price(price2num($in-$out, 'MT')).'</td>';
980  // print '<td>&nbsp;</td>';
981  }
982 }
983 print "</tr>\n";
984 
985 print "</table>";
986 print '</div>';
987 
988 llxFooter();
989 $db->close();
llxFooter()
Footer empty.
Definition: index.php:43
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm=false, $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
if(GETPOST('cancel','alpha')) if(!GETPOST('confirmmassaction','alpha')&&$massaction!= 'presend'&&$massaction!= 'confirm_presend')
Draft customers invoices.
Definition: list.php:147
img_previous($titlealt= 'default', $moreatt='')
Show previous logo.
img_next($titlealt= 'default', $moreatt='')
Show next logo.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition: date.lib.php:445
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage generation of HTML components Only common components must be here.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1')
Show information for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
llxHeader()
Header empty.
Definition: index.php:37
getEntity($element, $shared=1, $forceentity=null)
Get list of entity id to use.
dol_now($mode='gmt')
Return date for now.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:459
print
Draft customers invoices.
Definition: index.php:91
dol_getdate($timestamp, $fast=false)
Return an array with locale date info.
report_header($reportname, $notused, $period, $periodlink, $description, $builddate, $exportlink='', $moreparam=array(), $calcmode='', $varlink='')
Show header of a report.
Definition: report.lib.php:41
price2num($amount, $rounding='', $alreadysqlnb=0)
Function that return a number with universal decimal format (decimal separator is '...
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
Check permissions of a user to show a page and an object.