28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/ligneprelevement.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
33 $langs->loadLangs(array(
'banks',
'categories',
'withdrawals',
'companies'));
35 $type =
GETPOST(
'type',
'aZ09');
38 $socid =
GETPOST(
'socid',
'int');
40 $socid = $user->socid;
42 if ($type ==
'bank-transfer') {
43 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
53 $title = $langs->trans(
"WithdrawStatistics");
54 if ($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";
67 if ($type ==
'bank-transfer') {
68 $sql .=
" AND pb.type = 'bank-transfer'";
70 $sql .=
" AND pb.type = 'debit-order'";
72 $sql .=
" AND pb.entity = ".$conf->entity;
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;
100 if ($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"><td>';
123 print $ligne->LibStatut($row[2], 1);
125 print
'</td><td align="center">';
128 print
'</td><td class="right">';
129 print round($row[1] / $nbtotal * 100, 2).
" %";
131 print
'</td><td class="right">';
133 print
price($row[0]);
135 print
'</td><td class="right">';
136 print round($row[0] / $total * 100, 2).
" %";
142 print
'<tr class="liste_total"><td class="right">'.$langs->trans(
"Total").
'</td>';
143 print
'<td class="center">'.$nbtotal.
'</td><td> </td><td class="right">';
145 print
'</td><td class="right"> </td>';
146 print
"</tr></table>";
163 $sql =
"SELECT sum(pl.amount), count(pl.amount)";
164 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
165 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
166 $sql .=
" WHERE pl.fk_prelevement_bons = pb.rowid";
167 $sql .=
" AND pb.entity = ".$conf->entity;
168 $sql .=
" AND pl.statut = 3";
169 if ($type ==
'bank-transfer') {
170 $sql .=
" AND pb.type = 'bank-transfer'";
172 $sql .=
" AND pb.type = 'debit-order'";
174 $resql = $db->query($sql);
176 $num = $db->num_rows(
$resql);
180 $row = $db->fetch_row(
$resql);
190 $sql =
"SELECT sum(pl.amount), count(pl.amount) as cc, pr.motif";
191 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
192 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
193 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement_rejet as pr";
194 $sql .=
" WHERE pl.fk_prelevement_bons = pb.rowid";
195 $sql .=
" AND pb.entity = ".$conf->entity;
196 $sql .=
" AND pl.statut = 3";
197 $sql .=
" AND pr.fk_prelevement_lignes = pl.rowid";
198 if ($type ==
'bank-transfer') {
199 $sql .=
" AND pb.type = 'bank-transfer'";
201 $sql .=
" AND pb.type = 'debit-order'";
203 $sql .=
" GROUP BY pr.motif";
204 $sql .=
" ORDER BY cc DESC";
206 $resql = $db->query($sql);
208 $num = $db->num_rows(
$resql);
211 print
"\n<!-- debut table -->\n";
212 print
'<table class="noborder centpercent">';
213 print
'<tr class="liste_titre">';
214 print
'<td width="30%">'.$langs->trans(
"Status").
'</td><td align="center">'.$langs->trans(
"Number").
'</td>';
215 print
'<td class="right">%</td><td class="right">'.$langs->trans(
"Amount").
'</td><td class="right">%</td></tr>';
217 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/rejetprelevement.class.php';
221 $row = $db->fetch_row(
$resql);
223 print
'<tr class="oddeven"><td>';
224 print $Rejet->motifs[$row[2]];
226 print
'</td><td align="center">'.$row[1];
228 print
'</td><td class="right">';
229 print round($row[1] / $nbtotal * 100, 2).
" %";
231 print
'</td><td class="right">';
232 print
price($row[0]);
234 print
'</td><td class="right">';
235 print round($row[0] / $total * 100, 2).
" %";
242 print
'<tr class="liste_total"><td class="right">'.$langs->trans(
"Total").
'</td><td align="center">'.$nbtotal.
'</td>';
243 print
'<td> </td><td class="right">';
245 print
'</td><td class="right"> </td>';
246 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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
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.