27require
'../../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/prelevement.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/ligneprelevement.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
35$langs->loadLangs(array(
"banks",
"categories",
'withdrawals',
'bills'));
44$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
45$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
46$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
47$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
48if (empty($page) || $page == -1) {
51$offset = $limit * $page;
59include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
62if ($user->socid > 0) {
67if ($type ==
'bank-transfer') {
68 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
81llxHeader(
'', $langs->trans(
"WithdrawalsReceipts"));
84 if ($object->fetch($id, $ref) >= 0) {
86 print
dol_get_fiche_head($head,
'statistics', $langs->trans(
"WithdrawalsReceipts"), -1,
'payment');
88 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/prelevement/orders_list.php?restore_lastsearch_values=1'.($object->type !=
'bank-transfer' ?
'' :
'&type=bank-transfer').
'">'.$langs->trans(
"BackToList").
'</a>';
92 print
'<div class="fichecenter">';
93 print
'<div class="underbanner clearboth"></div>';
94 print
'<table class="border centpercent tableforfield">'.
"\n";
97 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Date").
'</td><td>'.
dol_print_date($object->datec,
'day').
'</td></tr>';
98 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td><span class="amount">'.
price($object->amount).
'</span></td></tr>';
100 if (!empty($object->date_trans)) {
101 $muser =
new User($db);
102 $muser->fetch($object->user_trans);
104 print
'<tr><td>'.$langs->trans(
"TransData").
'</td><td>';
106 print
' <span class="opacitymedium">'.$langs->trans(
"By").
'</span> '.$muser->getNomUrl(-1).
'</td></tr>';
107 print
'<tr><td>'.$langs->trans(
"TransMetod").
'</td><td>';
108 print $object->methodes_trans[$object->method_trans];
111 if (!empty($object->date_credit)) {
112 print
'<tr><td>'.$langs->trans(
'CreditDate').
'</td><td>';
121 print
'<div class="underbanner clearboth"></div>';
122 print
'<table class="border centpercent tableforfield">';
126 $fk_bank_account = $object->fk_bank_account;
127 if (empty($fk_bank_account)) {
128 $fk_bank_account = ($object->type ==
'bank-transfer' ?
getDolGlobalInt(
'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') :
getDolGlobalInt(
'PRELEVEMENT_ID_BANKACCOUNT'));
130 if ($fk_bank_account > 0) {
131 $result = $acc->fetch($fk_bank_account);
134 $labelofbankfield =
"BankToReceiveWithdraw";
135 if ($object->type ==
'bank-transfer') {
136 $labelofbankfield =
'BankToPayCreditTransfer';
139 print
'<tr><td class="titlefieldcreate">';
140 print $form->textwithpicto($langs->trans(
"BankAccount"), $langs->trans($labelofbankfield));
144 print $acc->getNomUrl(1);
149 $modulepart =
'prelevement';
150 if ($object->type ==
'bank-transfer') {
151 $modulepart =
'paymentbybanktransfer';
154 print
'<tr><td class="titlefieldcreate">';
155 $labelfororderfield =
'WithdrawalFile';
156 if ($object->type ==
'bank-transfer') {
157 $labelfororderfield =
'CreditTransferFile';
159 print $langs->trans($labelfororderfield).
'</td><td>';
161 if (isModEnabled(
'multicompany')) {
162 $labelentity = $conf->entity;
163 $relativepath =
'receipts/'.$object->ref.
'-'.$labelentity.
'.xml';
165 if ($type !=
'bank-transfer') {
166 $dir = $conf->prelevement->dir_output;
168 $dir = $conf->paymentbybanktransfer->dir_output;
171 $relativepath =
'receipts/'.$object->ref.
'.xml';
174 $relativepath =
'receipts/'.$object->ref.
'.xml';
177 print
'<a data-ajax="false" href="'.DOL_URL_ROOT.
'/document.php?type=text/plain&modulepart='.$modulepart.
'&file='.urlencode($relativepath).
'">'.$relativepath;
178 print
img_picto(
'',
'download',
'class="paddingleft"');
180 print
'</td></tr></table>';
194 $sql =
"SELECT sum(pl.amount), pl.statut";
195 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
196 $sql .=
" WHERE pl.fk_prelevement_bons = ".((int) $object->id);
197 $sql .=
" GROUP BY pl.statut";
199 $resql = $db->query($sql);
201 $num = $db->num_rows($resql);
206 print
"\n<!-- debut table -->\n";
207 print
'<div class="div-table-responsive-no-min">';
208 print
'<table class="noborder centpercent">';
209 print
'<tr class="liste_titre">';
210 print
'<td>'.$langs->trans(
"Status").
'</td><td class="right">'.$langs->trans(
"Amount").
'</td><td class="right">%</td></tr>';
213 $row = $db->fetch_row($resql);
215 print
'<tr class="oddeven"><td>';
217 print $line->LibStatut($row[1], 1);
221 print
'<td class="right"><span class="amount">';
222 print
price($row[0]);
223 print
'</span></td>';
225 print
'<td class="right">';
226 if ($object->amount) {
227 print round($row[0] / $object->amount * 100, 2).
" %";
242 print $db->error().
' '.$sql;
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class to manage withdrawal receipts.
Class to manage withdrawals.
Class to manage Dolibarr users.
dol_is_file($pathoffile)
Return if path is a file.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
prelevement_prepare_head(BonPrelevement $object)
Prepare array with list of tabs.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.