29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/prelevement.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/rejetprelevement.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
49$langs->loadLangs(array(
"banks",
"categories",
'withdrawals',
'bills'));
52if ($user->socid > 0) {
64$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
65$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
67if (empty($page) || $page == -1) {
70$offset = $limit * $page;
77include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
80if ($user->socid > 0) {
85if ($type ==
'bank-transfer') {
86 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
99$thirdpartystatic =
new Societe($db);
100$invoicestatic =
new Facture($db);
105llxHeader(
'', $langs->trans(
"WithdrawalsReceipts"));
107if ($id > 0 || $ref) {
108 if (
$object->fetch($id, $ref) >= 0) {
110 print
dol_get_fiche_head($head,
'rejects', $langs->trans(
"WithdrawalsReceipts"), -1,
'payment');
112 $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>';
114 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref');
116 print
'<div class="fichecenter">';
117 print
'<div class="underbanner clearboth"></div>';
118 print
'<table class="border centpercent tableforfield">'.
"\n";
121 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Date").
'</td><td>'.
dol_print_date(
$object->datec,
'day').
'</td></tr>';
122 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td><span class="amount">'.
price(
$object->amount).
'</span></td></tr>';
124 if (!empty(
$object->date_trans)) {
125 $muser =
new User($db);
126 $muser->fetch(
$object->user_trans);
128 print
'<tr><td>'.$langs->trans(
"TransData").
'</td><td>';
130 print
' <span class="opacitymedium">'.$langs->trans(
"By").
'</span> '.$muser->getNomUrl(-1).
'</td></tr>';
131 print
'<tr><td>'.$langs->trans(
"TransMetod").
'</td><td>';
135 if (!empty(
$object->date_credit)) {
136 print
'<tr><td>'.$langs->trans(
'CreditDate').
'</td><td>';
145 print
'<div class="underbanner clearboth"></div>';
146 print
'<table class="border centpercent tableforfield">';
150 $fk_bank_account =
$object->fk_bank_account;
151 if (empty($fk_bank_account)) {
154 if ($fk_bank_account > 0) {
155 $result = $acc->fetch($fk_bank_account);
158 $labelofbankfield =
"BankToReceiveWithdraw";
159 if (
$object->type ==
'bank-transfer') {
160 $labelofbankfield =
'BankToPayCreditTransfer';
163 print
'<tr><td class="titlefieldcreate">';
164 print $form->textwithpicto($langs->trans(
"BankAccount"), $langs->trans($labelofbankfield));
168 print $acc->getNomUrl(1);
173 $modulepart =
'prelevement';
174 if (
$object->type ==
'bank-transfer') {
175 $modulepart =
'paymentbybanktransfer';
178 print
'<tr><td class="titlefieldcreate">';
179 $labelfororderfield =
'WithdrawalFile';
180 if (
$object->type ==
'bank-transfer') {
181 $labelfororderfield =
'CreditTransferFile';
183 print $langs->trans($labelfororderfield).
'</td><td>';
185 if (isModEnabled(
'multicompany')) {
186 $labelentity =
$conf->entity;
187 $relativepath =
'receipts/'.$object->ref.
'-'.$labelentity.
'.xml';
189 if ($type !=
'bank-transfer') {
190 $dir =
$conf->prelevement->dir_output;
192 $dir =
$conf->paymentbybanktransfer->dir_output;
195 $relativepath =
'receipts/'.$object->ref.
'.xml';
198 $relativepath =
'receipts/'.$object->ref.
'.xml';
201 print
'<a data-ajax="false" href="'.DOL_URL_ROOT.
'/document.php?type=text/plain&modulepart='.$modulepart.
'&file='.urlencode($relativepath).
'">'.$relativepath;
202 print
img_picto(
'',
'download',
'class="paddingleft"');
204 print
'</td></tr></table>';
217$sql =
"SELECT pl.rowid, pl.amount, pl.statut";
218$sql .=
" , s.rowid as socid, s.nom as name";
219$sql .=
" , pr.motif, pr.afacturer, pr.fk_facture";
220$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
221$sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
222$sql .=
" , ".MAIN_DB_PREFIX.
"societe as s";
223$sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_rejet as pr";
224$sql .=
" WHERE p.rowid=".((int)
$object->id);
225$sql .=
" AND pl.fk_prelevement_bons = p.rowid";
226$sql .=
" AND p.entity IN (".getEntity(
'facture').
")";
227$sql .=
" AND pl.fk_soc = s.rowid";
228$sql .=
" AND pl.statut = 3 ";
229$sql .=
" AND pr.fk_prelevement_lignes = pl.rowid";
233$sql .=
" ORDER BY pl.amount DESC";
236$nbtotalofrecords =
'';
238 $result = $db->query($sql);
239 $nbtotalofrecords = $db->num_rows($result);
240 if (($page * $limit) > $nbtotalofrecords) {
246$sql .= $db->plimit($limit + 1, $offset);
248$resql = $db->query($sql);
250 $num = $db->num_rows($resql);
253 print_barre_liste($langs->trans(
"Rejects"), $page, $_SERVER[
"PHP_SELF"],
'', $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'');
255 print
"\n<!-- debut table -->\n";
256 print
'<div class="div-table-responsive-no-min">';
257 print
'<table class="noborder centpercent">';
258 print
'<tr class="liste_titre">';
259 print
'<td>'.$langs->trans(
"Line").
'</td><td>'.$langs->trans(
"ThirdParty").
'</td><td class="right">'.$langs->trans(
"Amount").
'</td>';
260 print
'<td>'.$langs->trans(
"Reason").
'</td><td align="center">'.$langs->trans(
"ToBill").
'</td>';
261 print
'<td class="center">';
272 $obj = $db->fetch_object($resql);
274 $thirdpartystatic->id = $obj->socid;
275 $thirdpartystatic->name = $obj->name;
277 if ($obj->fk_facture > 0) {
278 $invoicestatic->fetch($obj->fk_facture);
281 print
'<tr class="oddeven">';
283 print
'<a href="'.DOL_URL_ROOT.
'/compta/prelevement/line.php?id='.$obj->rowid.
'">';
284 print
img_picto(
'',
'statut'.$obj->statut).
' ';
285 print substr(
'000000'.$obj->rowid, -6);
288 if ($type !=
'bank-transfer') {
289 print $thirdpartystatic->getNomUrl(1,
'customer');
291 print $thirdpartystatic->getNomUrl(1,
'supplier');
295 print
'<td class="right"><span class="amount">'.price($obj->amount).
"</span></td>\n";
296 print
'<td>'.dol_escape_htmltag($rej->motifs[$obj->motif]).
'</td>';
298 print
'<td class="center">'.yn($obj->afacturer).
'</td>';
301 print
'<td class="center">';
302 if ($obj->fk_facture > 0) {
303 print $invoicestatic->getNomUrl(1);
309 $total += $obj->amount;
314 print
'<tr><td colspan="6"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
318 print
'<tr class="liste_total"><td> </td>';
319 print
'<td class="liste_total">'.$langs->trans(
"Total").
'</td>';
320 print
'<td class="right"><span class="amount">'.price($total).
"</span></td>\n";
321 print
'<td colspan="3"> </td>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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 bank accounts.
Class to manage withdrawal receipts.
Class to manage suppliers invoices.
Class to manage invoices.
Class to manage standing orders rejects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_is_file($pathoffile)
Return if path is a file.
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.