40 global $db, $langs,
$conf, $user;
45 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/card.php?id='.
$object->id;
46 $head[$h][1] = $langs->trans(
'CustomerInvoice');
47 $head[$h][2] =
'compta';
51 $nbContact = count(
$object->liste_contact(-1,
'internal')) + count(
$object->liste_contact(-1,
'external'));
52 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/contact.php?id='.urlencode((
string) (
$object->id));
53 $head[$h][1] = $langs->trans(
'ContactsAddresses');
55 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
57 $head[$h][2] =
'contact';
61 if (isModEnabled(
'prelevement')) {
62 $nbStandingOrders = 0;
63 $sql =
"SELECT COUNT(pfd.rowid) as nb";
64 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
65 $sql .=
" WHERE pfd.fk_facture = ".((int)
$object->id);
66 $sql .=
" AND type = 'ban'";
67 $resql = $db->query($sql);
69 $obj = $db->fetch_object($resql);
71 $nbStandingOrders = $obj->nb;
76 $langs->load(
"banks");
78 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/prelevement.php?id='.urlencode((
string) (
$object->id));
79 $head[$h][1] = $langs->trans(
'StandingOrders');
80 if ($nbStandingOrders > 0) {
81 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbStandingOrders.
'</span>';
83 $head[$h][2] =
'standingorders';
95 if (!empty(
$object->note_private)) {
98 if (!empty(
$object->note_public)) {
101 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/note.php?id='.
$object->id;
102 $head[$h][1] = $langs->trans(
'Notes');
104 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
106 $head[$h][2] =
'note';
110 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
111 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
113 if (!empty(
$conf->facture->multidir_output[
$object->entity])) {
116 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
118 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/document.php?id='.
$object->id;
119 $head[$h][1] = $langs->trans(
'Documents');
120 if (($nbFiles + $nbLinks) > 0) {
121 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
123 $head[$h][2] =
'documents';
126 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/agenda.php?id='.
$object->id;
127 $head[$h][1] = $langs->trans(
"Events");
128 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
131 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
132 $cachekey =
'count_events_facture_'.$object->id;
134 if (!is_null($dataretrieved)) {
135 $nbEvent = $dataretrieved;
137 $sql =
"SELECT COUNT(id) as nb";
138 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
139 $sql .=
" WHERE fk_element = ".((int)
$object->id);
140 $sql .=
" AND elementtype = 'invoice'";
141 $resql = $db->query($sql);
143 $obj = $db->fetch_object($resql);
146 dol_syslog(
'Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
152 $head[$h][1] .= $langs->trans(
"Agenda");
154 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
157 $head[$h][2] =
'agenda';
174 global $langs,
$conf, $user, $db;
177 $extrafields->fetch_name_optionals_label(
'facture');
178 $extrafields->fetch_name_optionals_label(
'facturedet');
179 $extrafields->fetch_name_optionals_label(
'facture_rec');
180 $extrafields->fetch_name_optionals_label(
'facturedet_rec');
185 $head[$h][0] = DOL_URL_ROOT.
'/admin/invoice.php';
186 $head[$h][1] = $langs->trans(
"Miscellaneous");
187 $head[$h][2] =
'general';
190 $head[$h][0] = DOL_URL_ROOT.
'/admin/payment.php';
191 $head[$h][1] = $langs->trans(
"Payments");
192 $head[$h][2] =
'payment';
201 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/admin/invoice_cust_extrafields.php';
202 $head[$h][1] = $langs->trans(
"ExtraFieldsCustomerInvoices");
203 $nbExtrafields = $extrafields->attributes[
'facture'][
'count'];
204 if ($nbExtrafields > 0) {
205 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
207 $head[$h][2] =
'attributes';
210 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/admin/invoicedet_cust_extrafields.php';
211 $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
212 $nbExtrafields = $extrafields->attributes[
'facturedet'][
'count'];
213 if ($nbExtrafields > 0) {
214 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
216 $head[$h][2] =
'attributeslines';
219 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/admin/invoice_rec_cust_extrafields.php';
220 $head[$h][1] = $langs->trans(
"ExtraFieldsCustomerInvoicesRec");
221 $nbExtrafields = $extrafields->attributes[
'facture_rec'][
'count'];
222 if ($nbExtrafields > 0) {
223 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
225 $head[$h][2] =
'attributesrec';
228 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/admin/invoicedet_rec_cust_extrafields.php';
229 $head[$h][1] = $langs->trans(
"ExtraFieldsLinesRec");
230 $nbExtrafields = $extrafields->attributes[
'facturedet_rec'][
'count'];
231 if ($nbExtrafields > 0) {
232 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
234 $head[$h][2] =
'attributeslinesrec';
238 $head[$h][0] = DOL_URL_ROOT.
'/admin/invoice_situation.php';
239 $head[$h][1] = $langs->trans(
"InvoiceSituation");
240 $head[$h][2] =
'situation';
258 global $db, $langs,
$conf, $user;
263 $head[$h][0] = DOL_URL_ROOT .
'/compta/facture/card-rec.php?id=' .
$object->id;
264 $head[$h][1] = $langs->trans(
"RepeatableInvoice");
265 $head[$h][2] =
'card';
268 $head[$h][0] = DOL_URL_ROOT .
'/compta/facture/list.php?search_fk_fac_rec_source=' .
$object->id;
269 $head[$h][1] = $langs->trans(
'InvoicesGeneratedFromRec');
272 $sql =
"SELECT COUNT(rowid) as nb";
273 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture";
274 $sql .=
" WHERE fk_fac_rec_source = ".((int)
$object->id);
275 $resql = $db->query($sql);
277 $obj = $db->fetch_object($resql);
278 $nbFacture = $obj->nb;
280 dol_syslog(
'Failed to count invoices with invoice model '.$db->lasterror(), LOG_ERR);
282 if ($nbFacture > 0) {
283 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbFacture.
'</span>';
285 $head[$h][2] =
'generated';
290 if (!empty(
$object->note_private)) {
293 if (!empty(
$object->note_public)) {
296 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/note-rec.php?id='.
$object->id;
297 $head[$h][1] = $langs->trans(
'Notes');
299 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
301 $head[$h][2] =
'note';
305 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/agenda-rec.php?id='.
$object->id;
306 $head[$h][1] = $langs->trans(
"Events");
307 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
310 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
311 $cachekey =
'count_events_facturerec_'.$object->id;
313 if (!is_null($dataretrieved)) {
314 $nbEvent = $dataretrieved;
316 $sql =
"SELECT COUNT(id) as nb";
317 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
318 $sql .=
" WHERE fk_element = ".((int)
$object->id);
319 $sql .=
" AND elementtype = 'invoicerec'";
320 $resql = $db->query($sql);
322 $obj = $db->fetch_object($resql);
325 dol_syslog(
'Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
331 $head[$h][1] .= $langs->trans(
"Agenda");
333 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
336 $head[$h][2] =
'agenda';
358 global $db, $langs,
$conf;
363 $head[$h][0] = DOL_URL_ROOT .
'/fourn/facture/card-rec.php?id=' .
$object->id;
364 $head[$h][1] = $langs->trans(
"RepeatableSupplierInvoice");
365 $head[$h][2] =
'card';
370 if (!empty(
$object->note_private)) {
373 if (!empty(
$object->note_public)) {
376 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/note-rec.php?id='.
$object->id;
377 $head[$h][1] = $langs->trans(
'Notes');
379 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
381 $head[$h][2] =
'note';
384 $head[$h][0] = DOL_URL_ROOT .
'/fourn/facture/list.php?search_fk_fac_rec_source=' .
$object->id;
385 $head[$h][1] = $langs->trans(
'InvoicesGeneratedFromRec');
389 $sql =
"SELECT COUNT(rowid) as nb";
390 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn";
391 $sql .=
" WHERE fk_fac_rec_source = ".((int)
$object->id);
392 $resql = $db->query($sql);
394 $obj = $db->fetch_object($resql);
395 $nbFactureFourn = $obj->nb;
397 dol_syslog(
'Failed to count invoices with supplier invoice model '.$db->lasterror(), LOG_ERR);
399 if ($nbFactureFourn > 0) {
400 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbFactureFourn.
'</span>';
402 $head[$h][2] =
'generated';
424 global
$conf, $db, $langs, $user;
426 if (($mode ==
'customers' && isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire'))
427 || ($mode ==
'suppliers' && (isModEnabled(
'fournisseur') || isModEnabled(
'supplier_invoice')) && $user->hasRight(
'fournisseur',
'facture',
'lire'))
429 global $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus8, $badgeStatus11;
430 include DOL_DOCUMENT_ROOT.
'/theme/'.
$conf->theme.
'/theme_vars.inc.php';
432 $now = date_create(date(
'Y-m-d',
dol_now()));
433 $datenowsub30 = date_create(date(
'Y-m-d',
dol_now()));
434 $datenowsub15 = date_create(date(
'Y-m-d',
dol_now()));
435 $datenowadd30 = date_create(date(
'Y-m-d',
dol_now()));
436 $datenowadd15 = date_create(date(
'Y-m-d',
dol_now()));
437 $interval30days = date_interval_create_from_date_string(
'30 days');
438 $interval15days = date_interval_create_from_date_string(
'15 days');
439 date_sub($datenowsub30, $interval30days);
440 date_sub($datenowsub15, $interval15days);
441 date_add($datenowadd30, $interval30days);
442 date_add($datenowadd15, $interval15days);
447 $sql .=
" sum(".$db->ifsql(
"f.date_lim_reglement < '".date_format($datenowsub30,
'Y-m-d').
"'", $amount_mode ?
"f.total_ht" : 1, 0).
") as late30";
448 $sql .=
", sum(".$db->ifsql(
"f.date_lim_reglement < '".date_format($datenowsub15,
'Y-m-d').
"' AND f.date_lim_reglement >= '".date_format($datenowsub30,
'Y-m-d').
"'", $amount_mode ?
"f.total_ht" : 1, 0).
") as late15";
449 $sql .=
", sum(".$db->ifsql(
"f.date_lim_reglement < '".date_format($now,
'Y-m-d').
"' AND f.date_lim_reglement >= '".date_format($datenowsub15,
'Y-m-d').
"'", $amount_mode ?
"f.total_ht" : 1, 0).
") as latenow";
450 $sql .=
", sum(".$db->ifsql(
"f.date_lim_reglement >= '".date_format($now,
'Y-m-d').
"' AND f.date_lim_reglement < '".date_format($datenowadd15,
'Y-m-d').
"'", $amount_mode ?
"f.total_ht" : 1, 0).
") as notlatenow";
451 $sql .=
", sum(".$db->ifsql(
"f.date_lim_reglement >= '".date_format($datenowadd15,
'Y-m-d').
"' AND f.date_lim_reglement < '".date_format($datenowadd30,
'Y-m-d').
"'", $amount_mode ?
"f.total_ht" : 1, 0).
") as notlate15";
452 $sql .=
", sum(".$db->ifsql(
"f.date_lim_reglement >= '".date_format($datenowadd30,
'Y-m-d').
"'", $amount_mode ?
"f.total_ht" : 1, 0).
") as notlate30";
453 if ($mode ==
'customers') {
454 $element =
'invoice';
455 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
456 } elseif ($mode ==
'fourn' || $mode ==
'suppliers') {
457 $element =
'supplier_invoice';
458 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
462 $sql .=
" WHERE f.entity IN (".getEntity($element).
")";
463 $sql .=
" AND f.type <> 2";
464 $sql .=
" AND f.fk_statut = 1";
465 if (isset($user->socid) && $user->socid > 0) {
466 $sql .=
" AND f.fk_soc = ".((int) $user->socid);
469 $resql = $db->query($sql);
471 $num = $db->num_rows($resql);
474 $dataseries = array();
477 $obj = $db->fetch_object($resql);
486 $dataseries[$i] = array($langs->transnoentitiesnoconv(
'NbOfOpenInvoices'), $obj->late30, $obj->late15, $obj->latenow, $obj->notlatenow, $obj->notlate15, $obj->notlate30);
489 if (!empty($dataseries[0])) {
490 foreach ($dataseries[0] as $key => $value) {
491 if (is_numeric($value)) {
497 $langs->trans(
'InvoiceLate30Days'),
498 $langs->trans(
'InvoiceLate15Days'),
499 $langs->trans(
'InvoiceLateMinus15Days'),
500 $mode ==
'customers' ? $langs->trans(
'InvoiceNotLate') : $langs->trans(
"InvoiceToPay"),
501 $mode ==
'customers' ? $langs->trans(
'InvoiceNotLate15Days') : $langs->trans(
"InvoiceToPay15Days"),
502 $mode ==
'customers' ? $langs->trans(
'InvoiceNotLate30Days') : $langs->trans(
"InvoiceToPay30Days"),
505 $colorseries = array($badgeStatus8, $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus11,
'-'.$badgeStatus11);
507 $result =
'<div class="div-table-responsive-no-min">';
508 $result .=
'<table class="noborder nohover centpercent">';
509 $result .=
'<tr class="liste_titre">';
510 $result .=
'<td>'.$langs->trans(
"NbOfOpenInvoices").
' - ';
511 if ($mode ==
'customers') {
512 $result .= $langs->trans(
"CustomerInvoice");
513 } elseif ($mode ==
'fourn' || $mode ==
'suppliers') {
514 $result .= $langs->trans(
"SupplierInvoice");
521 if (
$conf->use_javascript_ajax) {
524 $dolgraph->SetData($dataseries);
526 $dolgraph->setLegend($legend);
528 $dolgraph->SetDataColor(array_values($colorseries));
529 $dolgraph->setShowLegend(2);
530 $dolgraph->setShowPercent(1);
531 $dolgraph->SetType(array(
'bars',
'bars',
'bars',
'bars',
'bars',
'bars'));
533 $dolgraph->setHeight(
'160');
534 $dolgraph->setWidth(
'450');
535 $dolgraph->setHideXValues(
true);
536 if ($mode ==
'customers') {
537 $dolgraph->draw(
'idgraphcustomerinvoices');
538 } elseif ($mode ==
'fourn' || $mode ==
'suppliers') {
539 $dolgraph->draw(
'idgraphfourninvoices');
543 $result .=
'<tr maxwidth="255">';
544 $result .=
'<td class="center">'.$dolgraph->show($total ? 0 : $langs->trans(
"NoOpenInvoice")).
'</td>';
550 $result .=
'</table>';
570 global
$conf, $db, $langs, $user, $hookmanager;
574 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
575 if ($user->socid > 0) $socid = $user->socid;
578 $tmpinvoice =
new Facture($db);
580 $sql =
"SELECT f.rowid, f.ref, f.datef as date, f.total_ht, f.total_tva, f.total_ttc, f.ref_client";
581 $sql .=
", f.type, f.fk_statut as status, f.paye";
582 $sql .=
", s.nom as name";
583 $sql .=
", s.rowid as socid, s.email";
584 $sql .=
", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
585 $sql .=
", cc.rowid as country_id, cc.code as country_code";
586 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
587 $sql .=
", sc.fk_soc, sc.fk_user ";
589 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f, ".MAIN_DB_PREFIX.
"societe as s LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as cc ON cc.rowid = s.fk_pays";
590 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
591 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
593 $sql .=
" WHERE s.rowid = f.fk_soc AND f.fk_statut = ".Facture::STATUS_DRAFT;
594 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
595 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
596 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
600 $sql .=
" AND f.fk_soc = ".((int) $socid);
603 $parameters = array();
604 $reshook = $hookmanager->executeHooks(
'printFieldListWhereCustomerDraft', $parameters);
605 $sql .= $hookmanager->resPrint;
607 $sql .=
" GROUP BY f.rowid, f.ref, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,";
608 $sql .=
" s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
609 $sql .=
" cc.rowid, cc.code";
610 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
611 $sql .=
", sc.fk_soc, sc.fk_user";
615 $parameters = array();
616 $reshook = $hookmanager->executeHooks(
'printFieldListGroupByCustomerDraft', $parameters);
617 $sql .= $hookmanager->resPrint;
619 $resql = $db->query($sql);
622 $num = $db->num_rows($resql);
623 $nbofloop = min($num, $maxofloop);
625 $result .=
'<div class="div-table-responsive-no-min">';
626 $result .=
'<table class="noborder centpercent">';
628 $result .=
'<tr class="liste_titre">';
629 $result .=
'<th colspan="3">';
630 $result .= $langs->trans(
"CustomersDraftInvoices");
631 $result .=
'<a href="'.DOL_URL_ROOT.
'/compta/facture/list.php?search_status='.
Facture::STATUS_DRAFT.
'">';
632 $result .=
'<span class="badge marginleftonly">'.$num.
'</span>';
638 $companystatic =
new Societe($db);
643 while ($i < $nbofloop) {
644 $obj = $db->fetch_object($resql);
646 if ($i >= $maxCount) {
649 $tot_ttc += $obj->total_ttc;
653 $tmpinvoice->id = $obj->rowid;
654 $tmpinvoice->ref = $obj->ref;
655 $tmpinvoice->date = $db->jdate($obj->date);
656 $tmpinvoice->type = $obj->type;
657 $tmpinvoice->total_ht = $obj->total_ht;
658 $tmpinvoice->total_tva = $obj->total_tva;
659 $tmpinvoice->total_ttc = $obj->total_ttc;
660 $tmpinvoice->ref_client = $obj->ref_client;
661 $tmpinvoice->statut = $obj->status;
662 $tmpinvoice->paye = $obj->paye;
664 $companystatic->id = $obj->socid;
665 $companystatic->name = $obj->name;
666 $companystatic->email = $obj->email;
667 $companystatic->country_id = $obj->country_id;
668 $companystatic->country_code = $obj->country_code;
669 $companystatic->client = 1;
670 $companystatic->code_client = $obj->code_client;
671 $companystatic->code_fournisseur = $obj->code_fournisseur;
672 $companystatic->code_compta = $obj->code_compta;
673 $companystatic->code_compta_client = $obj->code_compta;
674 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
676 $result .=
'<tr class="oddeven">';
677 $result .=
'<td class="nowrap tdoverflowmax100">';
678 $result .= $tmpinvoice->getNomUrl(1,
'');
680 $result .=
'<td class="nowrap tdoverflowmax100">';
681 $result .= $companystatic->getNomUrl(1,
'customer');
683 $result .=
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
685 $tot_ttc += $obj->total_ttc;
690 $result .=
'<tr class="oddeven">';
691 $result .=
'<td class="nowrap" colspan="3">';
692 $result .=
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
694 $result .=
"</tr>\n";
697 $result .=
'<tr class="liste_total"><td class="left">'.$langs->trans(
"Total").
'</td>';
698 $result .=
'<td colspan="2" class="right">'.price($tot_ttc).
'</td>';
701 $result .=
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</span></td></tr>';
703 $result .=
"</table></div>";
722 global
$conf, $db, $langs, $user, $hookmanager;
726 if ((isModEnabled(
'fournisseur') || isModEnabled(
'supplier_invoice')) && $user->hasRight(
'facture',
'lire')) {
727 if ($user->socid > 0) $socid = $user->socid;
732 $sql =
"SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier, f.fk_statut as status, f.paye";
733 $sql .=
", s.nom as name";
734 $sql .=
", s.rowid as socid, s.email";
735 $sql .=
", s.code_client, s.code_compta";
736 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
737 $sql .=
", cc.rowid as country_id, cc.code as country_code";
738 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f, ".MAIN_DB_PREFIX.
"societe as s LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as cc ON cc.rowid = s.fk_pays";
739 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
740 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
742 $sql .=
" WHERE s.rowid = f.fk_soc AND f.fk_statut = ".FactureFournisseur::STATUS_DRAFT;
743 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
')';
744 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
745 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
748 $sql .=
" AND f.fk_soc = ".((int) $socid);
751 $parameters = array();
752 $reshook = $hookmanager->executeHooks(
'printFieldListWhereSupplierDraft', $parameters);
753 $sql .= $hookmanager->resPrint;
754 $resql = $db->query($sql);
757 $num = $db->num_rows($resql);
758 $nbofloop = min($num, $maxofloop);
760 $result .=
'<div class="div-table-responsive-no-min">';
761 $result .=
'<table class="noborder centpercent">';
763 $result .=
'<tr class="liste_titre">';
764 $result .=
'<th colspan="3">';
765 $result .= $langs->trans(
"SuppliersDraftInvoices");
767 $result .=
'<span class="badge marginleftonly">'.$num.
'</span>';
773 $companystatic =
new Societe($db);
778 while ($i < $nbofloop) {
779 $obj = $db->fetch_object($resql);
781 if ($i >= $maxCount) {
784 $tot_ttc += $obj->total_ttc;
788 $facturesupplierstatic->ref = $obj->ref;
789 $facturesupplierstatic->id = $obj->rowid;
790 $facturesupplierstatic->total_ht = $obj->total_ht;
791 $facturesupplierstatic->total_tva = $obj->total_tva;
792 $facturesupplierstatic->total_ttc = $obj->total_ttc;
793 $facturesupplierstatic->ref_supplier = $obj->ref_supplier;
794 $facturesupplierstatic->type = $obj->type;
795 $facturesupplierstatic->statut = $obj->status;
796 $facturesupplierstatic->status = $obj->status;
797 $facturesupplierstatic->paye = $obj->paye;
798 $facturesupplierstatic->paid = $obj->paye;
800 $companystatic->id = $obj->socid;
801 $companystatic->name = $obj->name;
802 $companystatic->email = $obj->email;
803 $companystatic->country_id = $obj->country_id;
804 $companystatic->country_code = $obj->country_code;
805 $companystatic->fournisseur = 1;
806 $companystatic->code_client = $obj->code_client;
807 $companystatic->code_fournisseur = $obj->code_fournisseur;
808 $companystatic->code_compta = $obj->code_compta;
809 $companystatic->code_compta_client = $obj->code_compta;
810 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
812 $result .=
'<tr class="oddeven">';
813 $result .=
'<td class="nowrap tdoverflowmax100">';
814 $result .= $facturesupplierstatic->getNomUrl(1,
'');
816 $result .=
'<td class="nowrap tdoverflowmax100">';
817 $result .= $companystatic->getNomUrl(1,
'supplier');
819 $result .=
'<td class="right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
821 $tot_ttc += $obj->total_ttc;
826 $result .=
'<tr class="oddeven">';
827 $result .=
'<td class="nowrap" colspan="3">';
828 $result .=
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
830 $result .=
"</tr>\n";
833 $result .=
'<tr class="liste_total"><td class="left">'.$langs->trans(
"Total").
'</td>';
834 $result .=
'<td colspan="2" class="right">'.price($tot_ttc).
'</td>';
837 $result .=
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</span></td></tr>';
839 $result .=
"</table></div>";
859 global
$conf, $db, $langs, $user;
860 if ($user->socid > 0) $socid = $user->socid;
861 $sql =
"SELECT f.rowid, f.entity, f.ref, f.fk_statut as status, f.paye, f.type, f.total_ht, f.total_tva, f.total_ttc, f.datec,";
862 $sql .=
" s.nom as socname, s.rowid as socid, s.canvas, s.client";
863 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
864 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
865 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
866 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
868 $sql .=
" WHERE f.fk_soc = s.rowid";
869 $sql .=
" AND f.entity IN (".getEntity(
'facture').
")";
871 $sql .=
" AND f.fk_soc = ".((int) $socid);
873 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
874 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
876 $sql .=
" ORDER BY f.tms DESC";
877 $sql .= $db->plimit($maxCount, 0);
879 $resql = $db->query($sql);
884 $num = $db->num_rows($resql);
886 $result =
'<div class="div-table-responsive-no-min">';
887 $result .=
'<table class="noborder centpercent">';
889 $result .=
'<tr class="liste_titre">';
890 $result .=
'<th colspan="3">'.$langs->trans(
"LastCustomersBills", $maxCount).
'</th>';
891 $result .=
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
892 $result .=
'<th class="right"></th>';
896 $result .=
'</table>';
902 $objectstatic =
new Facture($db);
903 $companystatic =
new Societe($db);
907 $obj = $db->fetch_object($resql);
909 $objectstatic->id = $obj->rowid;
910 $objectstatic->ref = $obj->ref;
911 $objectstatic->paye = $obj->paye;
912 $objectstatic->statut = $obj->status;
913 $objectstatic->status = $obj->status;
914 $objectstatic->total_ht = $obj->total_ht;
915 $objectstatic->total_tva = $obj->total_tva;
916 $objectstatic->total_ttc = $obj->total_ttc;
917 $objectstatic->type = $obj->type;
919 $companystatic->id = $obj->socid;
920 $companystatic->name = $obj->socname;
921 $companystatic->client = $obj->client;
922 $companystatic->canvas = $obj->canvas;
925 $filedir =
$conf->propal->multidir_output[$obj->entity].
'/'.$filename;
927 $result .=
'<tr class="oddeven">';
929 $result .=
'<td class="nowrap">';
930 $result .=
'<table class="nobordernopadding">';
931 $result .=
'<tr class="nocellnopadd">';
933 $result .=
'<td width="96" class="nobordernopadding nowrap">'.$objectstatic->getNomUrl(1).
'</td>';
934 $result .=
'<td width="16" class="nobordernopadding nowrap"> </td>';
935 $result .=
'<td width="16" class="nobordernopadding right">'.$formfile->getDocumentsLink($objectstatic->element, $filename, $filedir).
'</td>';
938 $result .=
'</table>';
941 $result .=
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
942 $result .=
'<td title="'.dol_print_date($db->jdate($obj->datec),
'day').
'">'.
dol_print_date($db->jdate($obj->datec),
'day').
'</td>';
943 $result .=
'<td class="right amount">'.price($obj->total_ttc).
'</td>';
946 $payment = $objectstatic->getSommePaiement();
947 $result .=
'<td class="right">'.$objectstatic->getLibStatut(3, $payment).
'</td>';
954 $result .=
'</table>';
968 global
$conf, $db, $langs, $user;
969 if ($user->socid > 0) $socid = $user->socid;
970 $sql =
"SELECT f.rowid, f.entity, f.ref, f.fk_statut as status, f.paye, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier, f.datec,";
971 $sql .=
" s.nom as socname, s.rowid as socid, s.canvas, s.client";
972 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
973 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
974 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
975 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
977 $sql .=
" WHERE f.fk_soc = s.rowid";
978 $sql .=
" AND f.entity IN (".getEntity(
'facture_fourn').
")";
980 $sql .=
" AND f.fk_soc = ".((int) $socid);
982 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
983 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
985 $sql .=
" ORDER BY f.tms DESC";
986 $sql .= $db->plimit($maxCount, 0);
988 $resql = $db->query($sql);
994 $num = $db->num_rows($resql);
996 $result =
'<div class="div-table-responsive-no-min">';
997 $result .=
'<table class="noborder centpercent">';
998 $result .=
'<tr class="liste_titre">';
999 $result .=
'<th colspan="3">'.$langs->trans(
"BoxTitleLastSupplierBills", $maxCount).
' ';
1000 $result .=
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/list.php?sortfield=f.tms&sortorder=DESC">';
1001 $result .=
'<span class="badge">...</span>';
1004 $result .=
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
1005 $result .=
'<th class="right"></th>';
1009 $result .=
'</table>';
1010 $result .=
'</div>';
1015 $companystatic =
new Societe($db);
1020 $obj = $db->fetch_object($resql);
1022 $objectstatic->id = $obj->rowid;
1023 $objectstatic->ref = $obj->ref;
1024 $objectstatic->paye = $obj->paye;
1025 $objectstatic->paid = $obj->paye;
1026 $objectstatic->statut = $obj->status;
1027 $objectstatic->status = $obj->status;
1028 $objectstatic->total_ht = $obj->total_ht;
1029 $objectstatic->total_tva = $obj->total_tva;
1030 $objectstatic->total_ttc = $obj->total_ttc;
1031 $objectstatic->type = $obj->type;
1033 $companystatic->id = $obj->socid;
1034 $companystatic->name = $obj->socname;
1035 $companystatic->client = $obj->client;
1036 $companystatic->canvas = $obj->canvas;
1039 $filedir =
$conf->propal->multidir_output[$obj->entity].
'/'.$filename;
1041 $result .=
'<tr class="nowrap">';
1043 $result .=
'<td class="oddeven">';
1044 $result .=
'<table class="nobordernopadding">';
1045 $result .=
'<tr class="nocellnopadd">';
1047 $result .=
'<td width="96" class="nobordernopadding nowrap">'.$objectstatic->getNomUrl(1).
'</td>';
1048 $result .=
'<td width="16" class="nobordernopadding nowrap"> </td>';
1049 $result .=
'<td width="16" class="nobordernopadding right">'.$formfile->getDocumentsLink($objectstatic->element, $filename, $filedir).
'</td>';
1052 $result .=
'</table>';
1055 $result .=
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
1057 $result .=
'<td title="'.$langs->trans(
"DateModification").
': '.
dol_print_date($db->jdate($obj->datec),
'dayhour').
'">'.
dol_print_date($db->jdate($obj->datec),
'day').
'</td>';
1059 $result .=
'<td class="amount right">'.price($obj->total_ttc).
'</td>';
1061 $result .=
'<td class="right">'.$objectstatic->getLibStatut(3).
'</td>';
1068 $result .=
'</table>';
1069 $result .=
'</div>';
1082 global
$conf, $db, $langs, $user, $hookmanager;
1086 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
1087 if ($user->socid > 0) $socid = $user->socid;
1088 $tmpinvoice =
new Facture($db);
1090 $sql =
"SELECT f.rowid, f.ref, f.fk_statut as status, f.datef, f.type, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.tms";
1091 $sql .=
", f.date_lim_reglement as datelimite";
1092 $sql .=
", s.nom as name";
1093 $sql .=
", s.rowid as socid, s.email";
1094 $sql .=
", s.code_client, s.code_compta";
1095 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
1096 $sql .=
", cc.rowid as country_id, cc.code as country_code";
1097 $sql .=
", sum(pf.amount) as am";
1098 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as cc ON cc.rowid = s.fk_pays,".MAIN_DB_PREFIX.
"facture as f";
1099 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiement_facture as pf on f.rowid=pf.fk_facture";
1100 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1101 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
1103 $sql .=
" WHERE s.rowid = f.fk_soc AND f.paye = 0 AND f.fk_statut = ".Facture::STATUS_VALIDATED;
1104 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
')';
1105 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1106 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1109 $sql .=
" AND f.fk_soc = ".((int) $socid);
1112 $parameters = array();
1113 $reshook = $hookmanager->executeHooks(
'printFieldListWhereCustomerUnpaid', $parameters);
1114 $sql .= $hookmanager->resPrint;
1116 $sql .=
" GROUP BY f.rowid, f.ref, f.fk_statut, f.datef, f.type, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
1117 $sql .=
" s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code";
1118 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
1119 $sql .=
" ORDER BY f.datef ASC, f.ref ASC";
1121 $resql = $db->query($sql);
1123 $num = $db->num_rows($resql);
1129 print
'<div class="div-table-responsive-no-min">';
1130 print
'<table class="noborder centpercent">';
1132 print
'<tr class="liste_titre">';
1133 print
'<th colspan="2">';
1134 print $langs->trans(
"BillsCustomersUnpaid", $num).
' ';
1136 print
'<span class="badge">'.$num.
'</span>';
1140 print
'<th class="right">'.$langs->trans(
"DateDue").
'</th>';
1142 print
'<th class="right">'.$langs->trans(
"AmountHT").
'</th>';
1144 print
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
1145 print
'<th class="right">'.$langs->trans(
"Received").
'</th>';
1146 print
'<th width="16"> </th>';
1149 $societestatic =
new Societe($db);
1150 $total_ttc = $totalam = $total = 0;
1152 $obj = $db->fetch_object($resql);
1154 if ($i >= $maxCount) {
1157 $total += $obj->total_ht;
1158 $total_ttc += $obj->total_ttc;
1159 $totalam += $obj->am;
1163 $tmpinvoice->ref = $obj->ref;
1164 $tmpinvoice->id = $obj->rowid;
1165 $tmpinvoice->total_ht = $obj->total_ht;
1166 $tmpinvoice->total_tva = $obj->total_tva;
1167 $tmpinvoice->total_ttc = $obj->total_ttc;
1168 $tmpinvoice->type = $obj->type;
1169 $tmpinvoice->statut = $obj->status;
1170 $tmpinvoice->paye = $obj->paye;
1171 $tmpinvoice->date_lim_reglement = $db->jdate($obj->datelimite);
1173 $societestatic->id = $obj->socid;
1174 $societestatic->name = $obj->name;
1175 $societestatic->email = $obj->email;
1176 $societestatic->country_id = $obj->country_id;
1177 $societestatic->country_code = $obj->country_code;
1178 $societestatic->client = 1;
1179 $societestatic->code_client = $obj->code_client;
1180 $societestatic->code_fournisseur = $obj->code_fournisseur;
1181 $societestatic->code_compta = $obj->code_compta;
1182 $societestatic->code_compta_client = $obj->code_compta;
1183 $societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1185 print
'<tr class="oddeven">';
1186 print
'<td class="nowrap">';
1188 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1189 print
'<td class="nobordernopadding nowrap">';
1190 print $tmpinvoice->getNomUrl(1,
'');
1192 print
'<td width="16" class="nobordernopadding hideonsmartphone right">';
1195 $urlsource = $_SERVER[
'PHP_SELF'].
'?facid='.$obj->rowid;
1196 print $formfile->getDocumentsLink($tmpinvoice->element, $filename, $filedir);
1197 print
'</td></tr></table>';
1200 print
'<td class="nowrap tdoverflowmax100">';
1201 print $societestatic->getNomUrl(1,
'customer');
1203 print
'<td class="right" title="'.dol_print_date($db->jdate($obj->datelimite),
'day').
'">';
1205 if ($tmpinvoice->hasDelay()) {
1210 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
'</span></td>';
1212 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
1213 print
'<td class="nowrap right"><span class="amount">'.price($obj->am).
'</span></td>';
1214 print
'<td>'.$tmpinvoice->getLibStatut(3, $obj->am).
'</td>';
1217 $total_ttc += $obj->total_ttc;
1218 $total += $obj->total_ht;
1219 $totalam += $obj->am;
1229 print
'<tr class="oddeven">';
1230 print
'<td class="nowrap" colspan="'.$colspan.
'">';
1231 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'... ('.$othernb.
')</span>';
1236 print
'<tr class="liste_total"><td colspan="2">'.$langs->trans(
"Total").
' <span style="font-weight: normal">('.$langs->trans(
"RemainderToTake").
': '.
price($total_ttc - $totalam).
')</span> </td>';
1237 print
'<td> </td>';
1239 print
'<td class="right"><span class="amount">'.price($total).
'</span></td>';
1241 print
'<td class="nowrap right"><span class="amount">'.price($total_ttc).
'</span></td>';
1242 print
'<td class="nowrap right"><span class="amount">'.price($totalam).
'</span></td>';
1243 print
'<td> </td>';
1250 print
'<tr class="oddeven"><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</td></tr>';
1252 print
'</table></div><br>';
1272 global
$conf, $db, $langs, $user, $hookmanager;
1276 if (isModEnabled(
"supplier_invoice") && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'read'))) {
1277 if ($user->socid > 0) $socid = $user->socid;
1280 $sql =
"SELECT ff.rowid, ff.ref, ff.fk_statut as status, ff.type, ff.libelle as label, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye";
1281 $sql .=
", ff.date_lim_reglement";
1282 $sql .=
", s.nom as name";
1283 $sql .=
", s.rowid as socid, s.email";
1284 $sql .=
", s.code_client, s.code_compta";
1285 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
1286 $sql .=
", sum(pf.amount) as am";
1287 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"facture_fourn as ff";
1288 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
1289 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1290 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
1292 $sql .=
" WHERE s.rowid = ff.fk_soc";
1293 $sql .=
" AND ff.entity = ".$conf->entity;
1294 $sql .=
" AND ff.paye = 0";
1295 $sql .=
" AND ff.fk_statut = ".FactureFournisseur::STATUS_VALIDATED;
1296 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1297 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1300 $sql .=
" AND ff.fk_soc = ".((int) $socid);
1303 $parameters = array();
1304 $reshook = $hookmanager->executeHooks(
'printFieldListWhereSupplierUnpaid', $parameters);
1305 $sql .= $hookmanager->resPrint;
1307 $sql .=
" GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.type, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye, ff.date_lim_reglement,";
1308 $sql .=
" s.nom, s.rowid, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
1309 $sql .=
" ORDER BY ff.date_lim_reglement ASC";
1311 $resql = $db->query($sql);
1313 $num = $db->num_rows($resql);
1316 print
'<div class="div-table-responsive-no-min">';
1317 print
'<table class="noborder centpercent">';
1319 print
'<tr class="liste_titre">';
1320 print
'<th colspan="2">';
1321 print $langs->trans(
"BillsSuppliersUnpaid", $num).
' ';
1323 print
'<span class="badge">'.$num.
'</span>';
1327 print
'<th class="right">'.$langs->trans(
"DateDue").
'</th>';
1329 print
'<th class="right">'.$langs->trans(
"AmountHT").
'</th>';
1331 print
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
1332 print
'<th class="right">'.$langs->trans(
"Paid").
'</th>';
1333 print
'<th width="16"> </th>';
1336 $societestatic =
new Societe($db);
1340 $total = $total_ttc = $totalam = 0;
1342 $obj = $db->fetch_object($resql);
1344 if ($i >= $maxCount) {
1347 $total += $obj->total_ht;
1348 $total_ttc += $obj->total_ttc;
1352 $facstatic->ref = $obj->ref;
1353 $facstatic->id = $obj->rowid;
1354 $facstatic->type = $obj->type;
1355 $facstatic->total_ht = $obj->total_ht;
1356 $facstatic->total_tva = $obj->total_tva;
1357 $facstatic->total_ttc = $obj->total_ttc;
1358 $facstatic->statut = $obj->status;
1359 $facstatic->status = $obj->status;
1360 $facstatic->paid = $obj->paye;
1361 $facstatic->paye = $obj->paye;
1363 $societestatic->id = $obj->socid;
1364 $societestatic->name = $obj->name;
1365 $societestatic->email = $obj->email;
1366 $societestatic->client = 0;
1367 $societestatic->fournisseur = 1;
1368 $societestatic->code_client = $obj->code_client;
1369 $societestatic->code_fournisseur = $obj->code_fournisseur;
1370 $societestatic->code_compta = $obj->code_compta;
1371 $societestatic->code_compta_client = $obj->code_compta;
1372 $societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1374 print
'<tr class="oddeven">';
1375 print
'<td class="nowrap tdoverflowmax100">';
1376 print $facstatic->getNomUrl(1,
'');
1378 print
'<td class="nowrap tdoverflowmax100">'.$societestatic->getNomUrl(1,
'supplier').
'</td>';
1379 print
'<td class="right">'.dol_print_date($db->jdate($obj->date_lim_reglement),
'day').
'</td>';
1381 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
'</span></td>';
1383 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
1384 print
'<td class="nowrap right"><span class="amount">'.price($obj->am).
'</span></td>';
1385 print
'<td>'.$facstatic->getLibStatut(3, $obj->am).
'</td>';
1387 $total += $obj->total_ht;
1388 $total_ttc += $obj->total_ttc;
1389 $totalam += $obj->am;
1398 print
'<tr class="oddeven">';
1399 print
'<td class="nowrap" colspan="'.$colspan.
'">';
1400 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'... ('.$othernb.
')</span>';
1405 print
'<tr class="liste_total"><td colspan="2">'.$langs->trans(
"Total").
' <span style="font-weight: normal">('.$langs->trans(
"RemainderToPay").
': '.
price($total_ttc - $totalam).
')</span> </td>';
1406 print
'<td> </td>';
1408 print
'<td class="right">'.price($total).
'</td>';
1410 print
'<td class="nowrap right">'.price($total_ttc).
'</td>';
1411 print
'<td class="nowrap right">'.price($totalam).
'</td>';
1412 print
'<td> </td>';
1419 print
'<tr class="oddeven"><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</td></tr>';
1421 print
'</table></div><br>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class to manage suppliers invoices.
const STATUS_VALIDATED
Validated (need to be paid)
Class to manage invoices.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated (need to be paid)
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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_now($mode='auto')
Return date for now.
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).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getNumberInvoicesPieChart($mode)
Return an HTML table that contains a pie chart of the number of customers or supplier invoices.
invoice_admin_prepare_head()
Return array head with list of tabs to view object information.
getCustomerInvoiceLatestEditTable($maxCount=5, $socid=0)
Return a HTML table that contains a list with latest edited customer invoices.
invoice_rec_prepare_head($object)
Return array head with list of tabs to view object information.
getPurchaseInvoiceLatestEditTable($maxCount=5, $socid=0)
Return a HTML table that contains a list with latest edited supplier invoices.
getCustomerInvoiceDraftTable($maxCount=500, $socid=0)
Return a HTML table that contains a list with customer invoice drafts.
supplier_invoice_rec_prepare_head($object)
Return array head with list of tabs to view object information.
getDraftSupplierTable($maxCount=500, $socid=0)
Return a HTML table that contains a list with customer invoice drafts.
getCustomerInvoiceUnpaidOpenTable($maxCount=500, $socid=0)
Return a HTML table that contains of unpaid customers invoices.
facture_prepare_head($object)
Initialize the array of tabs for customer invoice.
getPurchaseInvoiceUnpaidOpenTable($maxCount=500, $socid=0)
Return a HTML table that contains of unpaid purchase invoices.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
dol_setcache($memoryid, $data, $expire=0, $filecache=0)
Save data into a memory area shared by all users, all sessions on server.
dol_getcache($memoryid, $filecache=0)
Read a memory area shared by all users, all sessions on server.