28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/ligneprelevement.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
33$langs->loadLangs(array(
'banks',
'categories',
'withdrawals',
'companies'));
38$socid =
GETPOST(
'socid',
'int');
40 $socid = $user->socid;
42if ($type ==
'bank-transfer') {
43 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
53$title = $langs->trans(
"WithdrawStatistics");
54if ($type ==
'bank-transfer') {
55 $title = $langs->trans(
"CreditTransferStatistics");
63$sql =
"SELECT sum(pl.amount), count(pl.amount)";
64$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
65$sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
66$sql .=
" WHERE pl.fk_prelevement_bons = pb.rowid";
67if ($type ==
'bank-transfer') {
68 $sql .=
" AND pb.type = 'bank-transfer'";
70 $sql .=
" AND pb.type = 'debit-order'";
72$sql .=
" AND pb.entity = ".$conf->entity;
73$resql = $db->query($sql);
75 $num = $db->num_rows($resql);
79 $row = $db->fetch_row($resql);
95$sql =
"SELECT sum(pl.amount), count(pl.amount), pl.statut";
96$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
97$sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
98$sql .=
" WHERE pl.fk_prelevement_bons = pb.rowid";
99$sql .=
" AND pb.entity = ".$conf->entity;
100if ($type ==
'bank-transfer') {
101 $sql .=
" AND pb.type = 'bank-transfer'";
103 $sql .=
" AND pb.type = 'debit-order'";
105$sql .=
" GROUP BY pl.statut";
107$resql = $db->query($sql);
109 $num = $db->num_rows($resql);
112 print
"\n<!-- debut table -->\n";
113 print
'<table class="noborder centpercent">';
114 print
'<tr class="liste_titre">';
115 print
'<td width="30%">'.$langs->trans(
"Status").
'</td><td align="center">'.$langs->trans(
"Number").
'</td><td class="right">%</td>';
116 print
'<td class="right">'.$langs->trans(
"Amount").
'</td><td class="right">%</td></tr>';
119 $row = $db->fetch_row($resql);
121 print
'<tr class="oddeven">';
124 print $ligne->LibStatut($row[2], 1);
128 print
'<td align="center nowraponall">';
132 print
'<td class="right nowraponall">';
133 print round($row[1] / $nbtotal * 100, 2).
" %";
136 print
'<td class="right amount nowraponall">';
137 print
price($row[0]);
140 print
'<td class="right nowraponall">';
141 print round($row[0] / $total * 100, 2).
" %";
149 print
'<tr class="liste_total"><td class="right">'.$langs->trans(
"Total").
'</td>';
150 print
'<td class="center nowraponall">'.$nbtotal.
'</td><td> </td><td class="right nowraponall">';
152 print
'</td><td class="right"> </td>';
153 print
"</tr></table>";
170$sql =
"SELECT sum(pl.amount), count(pl.amount)";
171$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
172$sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
173$sql .=
" WHERE pl.fk_prelevement_bons = pb.rowid";
174$sql .=
" AND pb.entity = ".$conf->entity;
175$sql .=
" AND pl.statut = 3";
176if ($type ==
'bank-transfer') {
177 $sql .=
" AND pb.type = 'bank-transfer'";
179 $sql .=
" AND pb.type = 'debit-order'";
181$resql = $db->query($sql);
183 $num = $db->num_rows($resql);
187 $row = $db->fetch_row($resql);
197$sql =
"SELECT sum(pl.amount), count(pl.amount) as cc, pr.motif";
198$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
199$sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
200$sql .=
", ".MAIN_DB_PREFIX.
"prelevement_rejet as pr";
201$sql .=
" WHERE pl.fk_prelevement_bons = pb.rowid";
202$sql .=
" AND pb.entity = ".$conf->entity;
203$sql .=
" AND pl.statut = 3";
204$sql .=
" AND pr.fk_prelevement_lignes = pl.rowid";
205if ($type ==
'bank-transfer') {
206 $sql .=
" AND pb.type = 'bank-transfer'";
208 $sql .=
" AND pb.type = 'debit-order'";
210$sql .=
" GROUP BY pr.motif";
211$sql .=
" ORDER BY cc DESC";
213$resql = $db->query($sql);
215 $num = $db->num_rows($resql);
218 print
"\n<!-- debut table -->\n";
219 print
'<table class="noborder centpercent">';
220 print
'<tr class="liste_titre">';
221 print
'<td width="30%">'.$langs->trans(
"Status").
'</td><td align="center">'.$langs->trans(
"Number").
'</td>';
222 print
'<td class="right">%</td><td class="right">'.$langs->trans(
"Amount").
'</td><td class="right">%</td></tr>';
224 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/rejetprelevement.class.php';
228 $row = $db->fetch_row($resql);
230 print
'<tr class="oddeven"><td>';
231 print $Rejet->motifs[$row[2]];
233 print
'</td><td align="center">'.$row[1];
235 print
'</td><td class="right">';
236 print round($row[1] / $nbtotal * 100, 2).
" %";
238 print
'</td><td class="right">';
239 print
price($row[0]);
241 print
'</td><td class="right">';
242 print round($row[0] / $total * 100, 2).
" %";
249 print
'<tr class="liste_total"><td class="right">'.$langs->trans(
"Total").
'</td><td align="center">'.$nbtotal.
'</td>';
250 print
'<td> </td><td class="right">';
252 print
'</td><td class="right"> </td>';
253 print
"</tr></table>";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage withdrawals.
Class to manage standing orders rejects.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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.