32require
'../../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/prelevement.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
49$langs->loadLangs(array(
'banks',
'categories',
'withdrawals'));
54 $socid = $user->socid;
58$usercancreate = $user->hasRight(
'paymentbybanktransfer',
'create');
72llxHeader(
'', $langs->trans(
"SuppliersStandingOrdersArea"));
75 $langs->load(
"errors");
76 setEventMessages($langs->trans(
"ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv(
"PaymentByBankTransfer")),
null,
'errors');
79$thirdpartystatic =
new Societe($db);
87 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewPaymentByBankTransfer'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/compta/prelevement/create.php?type=bank-transfer');
90print
load_fiche_titre($langs->trans(
"SuppliersStandingOrdersArea"), $newcardbutton);
93print
'<div class="fichecenter"><div class="fichethirdleft">';
96print
'<div class="div-table-responsive-no-min">';
97print
'<table class="noborder centpercent">';
98print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
'</th></tr>';
102if (isModEnabled(
'supplier_invoice')) {
103 print
'<tr class="oddeven"><td>'.$langs->trans(
"NbOfInvoiceToPayByBankTransfer").
'</td>';
104 print
'<td class="right">';
105 $amounttoshow = $bprev->SommeAPrelever(
'bank-transfer');
106 print
'<a class="badge badge-info" href="'.DOL_URL_ROOT.
'/compta/prelevement/demandes.php?status=0&type=bank-transfer" title="'.
price($amounttoshow).
'">';
107 print $bprev->nbOfInvoiceToPay(
'bank-transfer');
110 $totaltoshow += $amounttoshow;
113if (isModEnabled(
'salaries')) {
114 print
'<tr class="oddeven"><td>'.$langs->trans(
"NbOfInvoiceToPayByBankTransferForSalaries").
'</td>';
115 print
'<td class="right">';
116 $amounttoshow = $bprev->SommeAPrelever(
'bank-transfer',
'salary');
117 print
'<a class="badge badge-info" href="'.DOL_URL_ROOT.
'/compta/prelevement/demandes.php?status=0&type=bank-transfer&sourcetype=salary" title="'.
price($amounttoshow).
'">';
118 print $bprev->nbOfInvoiceToPay(
'bank-transfer',
'salary');
121 $totaltoshow += $amounttoshow;
124print
'<tr class="oddeven"><td>'.$langs->trans(
"Total").
'</td>';
125print
'<td class="right"><span class="amount nowraponall">';
126print
price($totaltoshow, 0,
'', 1, -1, -1,
'auto');
127print
'</span></td></tr></table></div><br>';
133if (isModEnabled(
'supplier_invoice')) {
134 $sql =
"SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type, f.datef, f.date_lim_reglement,";
135 $sql .=
" pfd.date_demande, pfd.amount,";
136 $sql .=
" s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
137 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f,";
138 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s,";
139 $sql .=
" ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
140 $sql .=
" WHERE s.rowid = f.fk_soc";
141 $sql .=
" AND f.entity IN (".getEntity(
'supplier_invoice').
")";
142 $sql .=
" AND f.total_ttc > 0";
144 $sql .=
" AND f.fk_statut = ".FactureFournisseur::STATUS_VALIDATED;
146 $sql .=
" AND pfd.traite = 0";
147 $sql .=
" AND pfd.ext_payment_id IS NULL";
148 $sql .=
" AND pfd.fk_facture_fourn = f.rowid";
150 $sql .=
" AND f.fk_soc = ".((int) $socid);
153 $resql = $db->query($sql);
156 $num = $db->num_rows($resql);
159 print
'<div class="div-table-responsive-no-min">';
160 print
'<table class="noborder centpercent">';
161 print
'<tr class="liste_titre">';
162 print
'<th colspan="5">'.$langs->trans(
"SupplierInvoiceWaitingWithdraw").
' <span class="opacitymedium">('.$num.
')</span></th></tr>';
164 while ($i < $num && $i < 20) {
165 $obj = $db->fetch_object($resql);
167 $invoicestatic->id = $obj->rowid;
168 $invoicestatic->ref = $obj->ref;
169 $invoicestatic->status = $obj->fk_statut;
170 $invoicestatic->statut = $obj->fk_statut;
171 $invoicestatic->paye = $obj->paye;
172 $invoicestatic->paid = $obj->paye;
173 $invoicestatic->type = $obj->type;
174 $invoicestatic->date = $db->jdate($obj->datef);
175 $invoicestatic->date_echeance = $db->jdate($obj->date_lim_reglement);
176 $invoicestatic->total_ttc = $obj->total_ttc;
178 $alreadypayed = $invoicestatic->getSommePaiement();
180 $thirdpartystatic->id = $obj->socid;
181 $thirdpartystatic->name = $obj->name;
182 $thirdpartystatic->email = $obj->email;
183 $thirdpartystatic->tva_intra = $obj->tva_intra;
184 $thirdpartystatic->idprof1 = $obj->idprof1;
185 $thirdpartystatic->idprof2 = $obj->idprof2;
186 $thirdpartystatic->idprof3 = $obj->idprof3;
187 $thirdpartystatic->idprof4 = $obj->idprof4;
188 $thirdpartystatic->idprof5 = $obj->idprof5;
189 $thirdpartystatic->idprof6 = $obj->idprof6;
192 print
'<tr class="oddeven"><td class="nowraponall">';
193 print $invoicestatic->getNomUrl(1,
'withdraw');
196 print
'<td class="tdoverflowmax150">';
197 print $thirdpartystatic->getNomUrl(1,
'supplier');
200 print
'<td class="right">';
201 print
'<span class="amount">'.price($obj->amount).
'</span>';
204 print
'<td class="right">';
208 print
'<td class="right">';
209 print $invoicestatic->getLibStatut(3, $alreadypayed);
215 $titlefortab = $langs->transnoentitiesnoconv(
"BankTransfer");
216 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"NoSupplierInvoiceToWithdraw", $titlefortab, $titlefortab).
'</span></td></tr>';
218 print
"</table></div><br>";
224if (isModEnabled(
'salaries')) {
225 $sqlForSalary =
"SELECT * FROM ".MAIN_DB_PREFIX.
"salary as s, ".MAIN_DB_PREFIX.
"prelevement_demande as pd";
226 $sqlForSalary .=
" WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0";
227 $sqlForSalary .=
" AND s.entity IN (".getEntity(
'salary').
")";
229 $resql2 = $db->query($sqlForSalary);
231 $numRow = $db->num_rows($resql2);
234 print
'<div class="div-table-responsive-no-min">';
235 print
'<table class="noborder rightpercent">';
236 print
'<tr class="liste_titre">';
237 print
'<th colspan="5">'.$langs->trans(
"SalaryInvoiceWaitingWithdraw").
' <span class="opacitymedium">('.$numRow.
')</span></th></tr>';
240 while ($j < $numRow && $j < 10) {
241 $objSalary = $db->fetch_object($resql2);
243 $user->fetch($objSalary->fk_user);
245 $salary->fetch($objSalary->fk_salary);
247 $alreadypayedS = $salary->getSommePaiement();
249 print
'<tr class="oddeven"><td class="nowraponall">';
250 print $salary->getNomUrl(1);
253 print
'<td class="tdoverflowmax150">';
254 print $user->getNomUrl(-1);
257 print
'<td class="right">';
258 print
'<span class="amount">'.price($objSalary->amount).
'</span>';
261 print
'<td class="right" title="'.$langs->trans(
"DateRequest").
'">';
262 print
dol_print_date($db->jdate($objSalary->date_demande),
'day');
265 print
'<td class="right">';
266 print $salary->getLibStatut(3, $alreadypayedS);
272 $titlefortab = $langs->transnoentitiesnoconv(
"BankTransfer");
273 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"NoSalaryInvoiceToWithdraw", $titlefortab, $titlefortab).
'</span></td></tr>';
275 print
"</table></div><br>";
282print
'</div><div class="fichetwothirdright">';
289$sql =
"SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
290$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
291$sql .=
" WHERE p.type = 'bank-transfer'";
292$sql .=
" AND p.entity IN (".getEntity(
'invoice').
")";
293$sql .=
" ORDER BY datec DESC";
294$sql .= $db->plimit($limit);
296$result = $db->query($sql);
298 $num = $db->num_rows($result);
301 print
"\n<!-- debut table -->\n";
302 print
'<div class="div-table-responsive-no-min">';
303 print
'<table class="noborder centpercent">';
304 print
'<tr class="liste_titre">';
305 print
'<th>'.$langs->trans(
"LatestBankTransferReceipts", $limit).
'</th>';
306 print
'<th>'.$langs->trans(
"Date").
'</th>';
307 print
'<th class="right">'.$langs->trans(
"Amount").
'</th>';
308 print
'<th class="right">'.$langs->trans(
"Status").
'</th>';
312 while ($i < min($num, $limit)) {
313 $obj = $db->fetch_object($result);
315 print
'<tr class="oddeven">';
317 print
'<td class="nowraponall">';
318 $bprev->id = $obj->rowid;
319 $bprev->ref = $obj->ref;
320 $bprev->statut = $obj->statut;
321 print $bprev->getNomUrl(1);
323 print
'<td>'.dol_print_date($db->jdate($obj->datec),
"dayhour").
"</td>\n";
324 print
'<td class="right nowraponall"><span class="amount">'.price($obj->amount).
"</span></td>\n";
325 print
'<td class="right"><span class="amount">'.$bprev->getLibStatut(3).
"</span></td>\n";
331 print
'<tr><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
334 print
"</table></div><br>";
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 suppliers invoices.
Class to manage salary payments.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
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).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
prelevement_check_config($type='direct-debit')
Check need data to create standigns orders receipt file.
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.