30require
'../../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/ligneprelevement.class.php';
40require_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',
'',
'',
'');
58$usercancreate = $user->hasRight(
'prelevement',
'bons',
'creer');
65$title = $langs->trans(
"WithdrawalsReceipts");
66if ($type ==
'bank-transfer') {
67 $title = $langs->trans(
"BankTransferReceipts");
72$param =
'&type='.urlencode($type);
76$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/compta/prelevement/orders_list.php?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
77$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', DOL_URL_ROOT.
'/compta/prelevement/orders_list.php?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
78$newcardbutton .=
dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/compta/prelevement/stats.php?'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
81 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewStandingOrder'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/compta/prelevement/create.php?type='.urlencode($type));
84$massactionbutton =
'';
87print_barre_liste($title, 0, $_SERVER[
"PHP_SELF"], $param,
'',
'', $massactionbutton, 0, $langs->trans(
"Statistics"),
'generic', 0, $newcardbutton,
'', $limit, 0, 0, 1);
91$sql =
"SELECT sum(pb.amount) as amount, count(pb.amount) as nb";
93$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
94$sql .=
" WHERE pb.entity = ".$conf->entity;
95if ($type ==
'bank-transfer') {
96 $sql .=
" AND pb.type = 'bank-transfer'";
98 $sql .=
" AND pb.type = 'debit-order'";
103$resql =
$db->query($sql);
105 $num =
$db->num_rows($resql);
109 $obj =
$db->fetch_object($resql);
110 $total = $obj->amount;
126$sql =
"SELECT COUNT(pb.rowid) as nb, SUM(pb.amount) as amount, pb.statut as status";
128$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
130$sql .=
" WHERE pb.entity = ".$conf->entity;
131if ($type ==
'bank-transfer') {
132 $sql .=
" AND pb.type = 'bank-transfer'";
134 $sql .=
" AND pb.type = 'debit-order'";
136$sql .=
" GROUP BY pb.statut";
138$resql =
$db->query($sql);
140 $num =
$db->num_rows($resql);
143 print
"\n<!-- debut table -->\n";
144 print
'<table class="noborder centpercent">';
145 print
'<tr class="liste_titre">';
146 print
'<td width="30%">'.$langs->trans(
"Status").
'</td><td align="center">'.$langs->trans(
"Number").
'</td>';
148 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
153 $obj =
$db->fetch_object($resql);
155 print
'<tr class="oddeven">';
158 print $bon->LibStatut($obj->status, 1);
162 print
'<td class="center nowraponall">';
170 print
'<td class="right amount nowraponall">';
171 print
price($obj->amount);
185 print
'<tr class="liste_total"><td class="right">'.$langs->trans(
"Total").
'</td>';
186 print
'<td class="center nowraponall">'.$nbtotal.
'</td>';
188 print
'<td class="right nowraponall">';
192 print
"</tr></table>";
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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 withdrawal receipts.
Class to manage withdrawals.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.