30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/ligneprelevement.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
43$langs->loadLangs(array(
'banks',
'categories',
'withdrawals',
'companies'));
50 $socid = $user->socid;
52if ($type ==
'bank-transfer') {
53 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
63$title = $langs->trans(
"WithdrawStatistics");
64if ($type ==
'bank-transfer') {
65 $title = $langs->trans(
"CreditTransferStatistics");
73$sql =
"SELECT sum(pl.amount), count(pl.amount)";
74$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
75$sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
76$sql .=
" WHERE pl.fk_prelevement_bons = pb.rowid";
77if ($type ==
'bank-transfer') {
78 $sql .=
" AND pb.type = 'bank-transfer'";
80 $sql .=
" AND pb.type = 'debit-order'";
82$sql .=
" AND pb.entity = ".$conf->entity;
85$resql = $db->query($sql);
87 $num = $db->num_rows($resql);
91 $row = $db->fetch_row($resql);
107$sql =
"SELECT sum(pl.amount), count(pl.amount), pl.statut";
108$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
109$sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
110$sql .=
" WHERE pl.fk_prelevement_bons = pb.rowid";
111$sql .=
" AND pb.entity = ".$conf->entity;
112if ($type ==
'bank-transfer') {
113 $sql .=
" AND pb.type = 'bank-transfer'";
115 $sql .=
" AND pb.type = 'debit-order'";
117$sql .=
" GROUP BY pl.statut";
119$resql = $db->query($sql);
121 $num = $db->num_rows($resql);
124 print
"\n<!-- debut table -->\n";
125 print
'<table class="noborder centpercent">';
126 print
'<tr class="liste_titre">';
127 print
'<td width="30%">'.$langs->trans(
"Status").
'</td><td align="center">'.$langs->trans(
"Number").
'</td><td class="right">%</td>';
128 print
'<td class="right">'.$langs->trans(
"Amount").
'</td><td class="right">%</td></tr>';
131 $row = $db->fetch_row($resql);
133 print
'<tr class="oddeven">';
136 print $ligne->LibStatut($row[2], 1);
140 print
'<td class="center nowraponall">';
144 print
'<td class="right nowraponall">';
145 print
price2num($row[1] / $nbtotal * 100, 2).
" %";
148 print
'<td class="right amount nowraponall">';
149 print
price($row[0]);
152 print
'<td class="right nowraponall">';
153 print
price2num($row[0] / $total * 100, 2).
" %";
161 print
'<tr class="liste_total"><td class="right">'.$langs->trans(
"Total").
'</td>';
162 print
'<td class="center nowraponall">'.$nbtotal.
'</td><td> </td><td class="right nowraponall">';
164 print
'</td><td class="right"> </td>';
165 print
"</tr></table>";
182$sql =
"SELECT sum(pl.amount), count(pl.amount)";
183$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
184$sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
185$sql .=
" WHERE pl.fk_prelevement_bons = pb.rowid";
186$sql .=
" AND pb.entity = ".$conf->entity;
187$sql .=
" AND pl.statut = 3";
188if ($type ==
'bank-transfer') {
189 $sql .=
" AND pb.type = 'bank-transfer'";
191 $sql .=
" AND pb.type = 'debit-order'";
193$resql = $db->query($sql);
195 $num = $db->num_rows($resql);
199 $row = $db->fetch_row($resql);
209$sql =
"SELECT sum(pl.amount), count(pl.amount) as cc, pr.motif";
210$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
211$sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
212$sql .=
", ".MAIN_DB_PREFIX.
"prelevement_rejet as pr";
213$sql .=
" WHERE pl.fk_prelevement_bons = pb.rowid";
214$sql .=
" AND pb.entity = ".$conf->entity;
215$sql .=
" AND pl.statut = 3";
216$sql .=
" AND pr.fk_prelevement_lignes = pl.rowid";
217if ($type ==
'bank-transfer') {
218 $sql .=
" AND pb.type = 'bank-transfer'";
220 $sql .=
" AND pb.type = 'debit-order'";
222$sql .=
" GROUP BY pr.motif";
223$sql .=
" ORDER BY cc DESC";
225$resql = $db->query($sql);
227 $num = $db->num_rows($resql);
230 print
"\n<!-- debut table -->\n";
231 print
'<table class="noborder centpercent">';
232 print
'<tr class="liste_titre">';
233 print
'<td width="30%">'.$langs->trans(
"Status").
'</td><td align="center">'.$langs->trans(
"Number").
'</td>';
234 print
'<td class="right">%</td><td class="right">'.$langs->trans(
"Amount").
'</td><td class="right">%</td></tr>';
236 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/rejetprelevement.class.php';
240 $row = $db->fetch_row($resql);
242 print
'<tr class="oddeven"><td>';
243 print $Rejet->motifs[$row[2]];
246 print
'<td class="center">'.$row[1];
249 print
'<td class="right">';
250 print
price2num($row[1] / $nbtotal * 100, 2).
" %";
252 print
'</td><td class="right">';
253 print
price($row[0]);
255 print
'</td><td class="right">';
256 print
price2num($row[0] / $total * 100, 2).
" %";
263 print
'<tr class="liste_total"><td class="right">'.$langs->trans(
"Total").
'</td><td align="center">'.$nbtotal.
'</td>';
264 print
'<td> </td><td class="right">';
266 print
'</td><td class="right"> </td>';
267 print
"</tr></table>";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage withdrawals.
Class to manage standing orders rejects.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.