40 global $db, $langs,
$conf, $user;
45 $head[$h][0] =
dolBuildUrl(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] =
dolBuildUrl(DOL_URL_ROOT.
'/compta/facture/contact.php', [
'id' =>
$object->id]);
53 $head[$h][1] = $langs->trans(
'ContactsAddresses');
55 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
57 $head[$h][2] =
'contact';
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] =
dolBuildUrl(DOL_URL_ROOT.
'/compta/facture/prelevement.php', [
'id' =>
$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] =
dolBuildUrl(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] =
dolBuildUrl(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] =
dolBuildUrl(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, $extrafields;
176 $extrafields->fetch_name_optionals_label(
'facture');
177 $extrafields->fetch_name_optionals_label(
'facturedet');
178 $extrafields->fetch_name_optionals_label(
'facture_rec');
179 $extrafields->fetch_name_optionals_label(
'facturedet_rec');
184 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/invoice.php');
185 $head[$h][1] = $langs->trans(
"Miscellaneous");
186 $head[$h][2] =
'general';
189 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/payment.php');
190 $head[$h][1] = $langs->trans(
"Payments");
191 $head[$h][2] =
'payment';
200 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/extrafields.php', array(
'elementtype' =>
'facture'));
201 $head[$h][1] = $langs->trans(
"ExtraFieldsCustomerInvoices");
202 $nbExtrafields = $extrafields->attributes[
'facture'][
'count'];
203 if ($nbExtrafields > 0) {
204 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
206 $head[$h][2] =
'attributes';
209 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/extrafields.php', array(
'elementtype' =>
'facturedet'));
210 $head[$h][1] = $langs->trans(
"ExtraFieldsLines");
211 $nbExtrafields = $extrafields->attributes[
'facturedet'][
'count'];
212 if ($nbExtrafields > 0) {
213 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
215 $head[$h][2] =
'attributeslines';
218 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/extrafields.php', array(
'elementtype' =>
'facture_rec'));
219 $head[$h][1] = $langs->trans(
"ExtraFieldsCustomerInvoicesRec");
220 $nbExtrafields = $extrafields->attributes[
'facture_rec'][
'count'];
221 if ($nbExtrafields > 0) {
222 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
224 $head[$h][2] =
'attributesrec';
227 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/extrafields.php', array(
'elementtype' =>
'facturedet_rec'));
228 $head[$h][1] = $langs->trans(
"ExtraFieldsLinesRec");
229 $nbExtrafields = $extrafields->attributes[
'facturedet_rec'][
'count'];
230 if ($nbExtrafields > 0) {
231 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
233 $head[$h][2] =
'attributeslinesrec';
237 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/invoice_situation.php');
238 $head[$h][1] = $langs->trans(
"InvoiceSituation");
239 $head[$h][2] =
'situation';
257 global $db, $langs,
$conf, $user;
262 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT .
'/compta/facture/card-rec.php', [
'id' =>
$object->id]);
263 $head[$h][1] = $langs->trans(
"RepeatableInvoice");
264 $head[$h][2] =
'card';
267 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT .
'/compta/facture/list.php', [
'search_fk_fac_rec_source' =>
$object->id]);
268 $head[$h][1] = $langs->trans(
'InvoicesGeneratedFromRec');
271 $sql =
"SELECT COUNT(rowid) as nb";
272 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture";
273 $sql .=
" WHERE fk_fac_rec_source = ".((int)
$object->id);
274 $resql = $db->query($sql);
276 $obj = $db->fetch_object($resql);
277 $nbFacture = $obj->nb;
279 dol_syslog(
'Failed to count invoices with invoice model '.$db->lasterror(), LOG_ERR);
281 if ($nbFacture > 0) {
282 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbFacture.
'</span>';
284 $head[$h][2] =
'generated';
289 if (!empty(
$object->note_private)) {
292 if (!empty(
$object->note_public)) {
295 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/compta/facture/note-rec.php', [
'id' =>
$object->id]);
296 $head[$h][1] = $langs->trans(
'Notes');
298 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
300 $head[$h][2] =
'note';
304 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/compta/facture/agenda-rec.php', [
'id' =>
$object->id]);
305 $head[$h][1] = $langs->trans(
"Events");
306 if (
isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
309 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
310 $cachekey =
'count_events_facturerec_'.$object->id;
312 if (!is_null($dataretrieved)) {
313 $nbEvent = $dataretrieved;
315 $sql =
"SELECT COUNT(id) as nb";
316 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
317 $sql .=
" WHERE fk_element = ".((int)
$object->id);
318 $sql .=
" AND elementtype = 'invoicerec'";
319 $resql = $db->query($sql);
321 $obj = $db->fetch_object($resql);
324 dol_syslog(
'Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
330 $head[$h][1] .= $langs->trans(
"Agenda");
332 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
335 $head[$h][2] =
'agenda';
357 global $db, $langs,
$conf;
362 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT .
'/fourn/facture/card-rec.php', [
'id' =>
$object->id]);
363 $head[$h][1] = $langs->trans(
"RepeatableSupplierInvoice");
364 $head[$h][2] =
'card';
369 if (!empty(
$object->note_private)) {
372 if (!empty(
$object->note_public)) {
375 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/fourn/facture/note-rec.php', [
'id' =>
$object->id]);
376 $head[$h][1] = $langs->trans(
'Notes');
378 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
380 $head[$h][2] =
'note';
383 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT .
'/fourn/facture/list.php', [
'search_fk_fac_rec_source' =>
$object->id]);
384 $head[$h][1] = $langs->trans(
'InvoicesGeneratedFromRec');
388 $sql =
"SELECT COUNT(rowid) as nb";
389 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn";
390 $sql .=
" WHERE fk_fac_rec_source = ".((int)
$object->id);
391 $resql = $db->query($sql);
393 $obj = $db->fetch_object($resql);
394 $nbFactureFourn = $obj->nb;
396 dol_syslog(
'Failed to count invoices with supplier invoice model '.$db->lasterror(), LOG_ERR);
398 if ($nbFactureFourn > 0) {
399 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbFactureFourn.
'</span>';
401 $head[$h][2] =
'generated';
423 global
$conf, $db, $langs, $user;
425 if (($mode ==
'customers' &&
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire'))
426 || ($mode ==
'suppliers' && (
isModEnabled(
'fournisseur') ||
isModEnabled(
'supplier_invoice')) && $user->hasRight(
'fournisseur',
'facture',
'lire'))
428 global $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus11;
430 if ($theme_vars_file) {
431 include $theme_vars_file;
435 $datenowsub30 = date_create(
date(
'Y-m-d',
dol_now()));
436 $datenowsub15 = date_create(
date(
'Y-m-d',
dol_now()));
437 $datenowadd30 = date_create(
date(
'Y-m-d',
dol_now()));
438 $datenowadd15 = date_create(
date(
'Y-m-d',
dol_now()));
439 $interval30days = date_interval_create_from_date_string(
'30 days');
440 $interval15days = date_interval_create_from_date_string(
'15 days');
441 date_sub($datenowsub30, $interval30days);
442 date_sub($datenowsub15, $interval15days);
443 date_add($datenowadd30, $interval30days);
444 date_add($datenowadd15, $interval15days);
449 $sql .=
" sum(".$db->ifsql(
"f.date_lim_reglement < '".date_format($datenowsub30,
'Y-m-d').
"'", $amount_mode ?
"f.total_ht" : 1,
'0').
") as late30";
450 $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";
451 $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";
452 $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";
453 $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";
454 $sql .=
", sum(".$db->ifsql(
"f.date_lim_reglement >= '".date_format($datenowadd30,
'Y-m-d').
"'", $amount_mode ?
"f.total_ht" : 1,
'0').
") as notlate30";
455 if ($mode ==
'customers') {
456 $element =
'invoice';
457 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
458 } elseif ($mode ==
'suppliers') {
459 $element =
'supplier_invoice';
460 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
464 $sql .=
" WHERE f.entity IN (".getEntity($element).
")";
465 $sql .=
" AND f.type <> 2";
466 $sql .=
" AND f.fk_statut = 1";
467 if (isset($user->socid) && $user->socid > 0) {
468 $sql .=
" AND f.fk_soc = ".((int) $user->socid);
471 $resql = $db->query($sql);
473 $num = $db->num_rows($resql);
476 $dataseries = array();
479 $obj = $db->fetch_object($resql);
490 $dataseries[$i] = array($langs->transnoentitiesnoconv(
'NbOfOpenInvoices'), $obj->late30, $obj->late15, $obj->latenow, $obj->notlatenow, $obj->notlate15, $obj->notlate30);
493 if (!empty($dataseries[0])) {
494 foreach ($dataseries[0] as $key => $value) {
495 if (is_numeric($value)) {
501 $langs->trans(
'InvoiceLate30Days'),
502 $langs->trans(
'InvoiceLate15Days'),
503 $langs->trans(
'InvoiceLateMinus15Days'),
504 $mode ==
'customers' ? $langs->trans(
'InvoiceNotLate') : $langs->trans(
"InvoiceToPay"),
505 $mode ==
'customers' ? $langs->trans(
'InvoiceNotLate15Days') : $langs->trans(
"InvoiceToPay15Days"),
506 $mode ==
'customers' ? $langs->trans(
'InvoiceNotLate30Days') : $langs->trans(
"InvoiceToPay30Days"),
509 $colorseries = array(
'#998844', $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus11,
'-'.$badgeStatus11);
511 $result =
'<div class="div-table-responsive-no-min">';
512 $result .=
'<table class="noborder nohover centpercent">';
513 $result .=
'<tr class="liste_titre">';
514 $result .=
'<td>'.$langs->trans(
"NbOfOpenInvoices").
' - ';
515 if ($mode ==
'customers') {
516 $result .= $langs->trans(
"CustomerInvoice");
517 } elseif ($mode ==
'suppliers') {
518 $result .= $langs->trans(
"SupplierInvoice");
525 if (
$conf->use_javascript_ajax) {
527 $dolgraph->SetData($dataseries);
529 $dolgraph->setLegend($legend);
531 $dolgraph->SetDataColor($colorseries);
532 $dolgraph->setShowLegend(2);
533 $dolgraph->setShowPercent(1);
534 $dolgraph->SetType(array(
'bars',
'bars',
'bars',
'bars',
'bars',
'bars'));
536 $dolgraph->setHeight(
'160');
537 $dolgraph->setWidth(
'450');
538 $dolgraph->setHideXValues(
true);
540 if ($mode ==
'customers') {
541 $dolgraph->draw(
'idgraphcustomerinvoices');
542 } elseif ($mode ==
'suppliers') {
543 $dolgraph->draw(
'idgraphfourninvoices');
547 $result .=
'<tr maxwidth="255">';
548 $result .=
'<td class="center">'.$dolgraph->show($total ? 0 : $langs->trans(
"NoOpenInvoice")).
'</td>';
554 $result .=
'</table>';
559 dol_print_error($db);
574 global
$conf, $db, $langs, $user, $hookmanager;
578 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
579 if ($user->socid > 0) {
580 $socid = $user->socid;
584 $tmpinvoice =
new Facture($db);
586 $sql =
"SELECT f.rowid, f.ref, f.datef as date, f.total_ht, f.total_tva, f.total_ttc, f.ref_client";
587 $sql .=
", f.type, f.fk_statut as status, f.paye";
588 $sql .=
", s.nom as name";
589 $sql .=
", s.rowid as socid, s.email";
590 $sql .=
", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
591 $sql .=
", cc.rowid as country_id, cc.code as country_code";
592 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
593 $sql .=
", sc.fk_soc, sc.fk_user ";
595 $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";
596 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
597 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
599 $sql .=
" WHERE s.rowid = f.fk_soc AND f.fk_statut = ".Facture::STATUS_DRAFT;
600 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
601 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
602 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
606 $sql .=
" AND f.fk_soc = ".((int) $socid);
609 $parameters = array();
610 $reshook = $hookmanager->executeHooks(
'printFieldListWhereCustomerDraft', $parameters);
611 $sql .= $hookmanager->resPrint;
613 $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,";
614 $sql .=
" s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
615 $sql .=
" cc.rowid, cc.code";
616 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
617 $sql .=
", sc.fk_soc, sc.fk_user";
621 $parameters = array();
622 $reshook = $hookmanager->executeHooks(
'printFieldListGroupByCustomerDraft', $parameters);
623 $sql .= $hookmanager->resPrint;
625 $resql = $db->query($sql);
628 $num = $db->num_rows($resql);
629 $nbofloop = min($num, $maxofloop);
631 $result .=
'<div class="div-table-responsive-no-min">';
632 $result .=
'<table class="noborder centpercent">';
634 $result .=
'<tr class="liste_titre">';
635 $result .=
'<th colspan="3">';
636 $result .= $langs->trans(
"CustomersDraftInvoices");
637 $result .=
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/compta/facture/list.php', [
'search_status' =>
Facture::STATUS_DRAFT]).
'">';
638 $result .=
'<span class="badge marginleftonly">'.$num.
'</span>';
644 $companystatic =
new Societe($db);
649 while ($i < $nbofloop) {
650 $obj = $db->fetch_object($resql);
652 if ($i >= $maxCount) {
655 $tot_ttc += $obj->total_ttc;
659 $tmpinvoice->id = $obj->rowid;
660 $tmpinvoice->ref = $obj->ref;
661 $tmpinvoice->date = $db->jdate($obj->date);
662 $tmpinvoice->type = $obj->type;
663 $tmpinvoice->total_ht = $obj->total_ht;
664 $tmpinvoice->total_tva = $obj->total_tva;
665 $tmpinvoice->total_ttc = $obj->total_ttc;
666 $tmpinvoice->ref_client = $obj->ref_client;
667 $tmpinvoice->statut = $obj->status;
668 $tmpinvoice->paye = $obj->paye;
670 $companystatic->id = $obj->socid;
671 $companystatic->name = $obj->name;
672 $companystatic->email = $obj->email;
673 $companystatic->country_id = $obj->country_id;
674 $companystatic->country_code = $obj->country_code;
675 $companystatic->client = 1;
676 $companystatic->code_client = $obj->code_client;
677 $companystatic->code_fournisseur = $obj->code_fournisseur;
678 $companystatic->code_compta = $obj->code_compta;
679 $companystatic->code_compta_client = $obj->code_compta;
680 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
682 $result .=
'<tr class="oddeven">';
683 $result .=
'<td class="nowrap tdoverflowmax100">';
684 $result .= $tmpinvoice->getNomUrl(1,
'');
686 $result .=
'<td class="nowrap tdoverflowmax100">';
687 $result .= $companystatic->getNomUrl(1,
'customer');
689 $result .=
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
691 $tot_ttc += $obj->total_ttc;
696 $result .=
'<tr class="oddeven">';
697 $result .=
'<td class="nowrap" colspan="3">';
698 $result .=
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
700 $result .=
"</tr>\n";
703 $result .=
'<tr class="liste_total"><td class="left">'.$langs->trans(
"Total").
'</td>';
704 $result .=
'<td colspan="2" class="right">'.price($tot_ttc).
'</td>';
707 $result .=
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</span></td></tr>';
709 $result .=
"</table></div>";
712 dol_print_error($db);
728 global
$conf, $db, $langs, $user, $hookmanager;
733 if ($user->socid > 0) {
734 $socid = $user->socid;
740 $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";
741 $sql .=
", s.nom as name";
742 $sql .=
", s.rowid as socid, s.email";
743 $sql .=
", s.code_client, s.code_compta";
744 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
745 $sql .=
", cc.rowid as country_id, cc.code as country_code";
746 $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";
747 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
748 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
750 $sql .=
" WHERE s.rowid = f.fk_soc AND f.fk_statut = ".FactureFournisseur::STATUS_DRAFT;
751 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
')';
752 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
753 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
756 $sql .=
" AND f.fk_soc = ".((int) $socid);
759 $parameters = array();
760 $reshook = $hookmanager->executeHooks(
'printFieldListWhereSupplierDraft', $parameters);
761 $sql .= $hookmanager->resPrint;
762 $resql = $db->query($sql);
765 $num = $db->num_rows($resql);
766 $nbofloop = min($num, $maxofloop);
768 $result .=
'<div class="div-table-responsive-no-min">';
769 $result .=
'<table class="noborder centpercent">';
771 $result .=
'<tr class="liste_titre">';
772 $result .=
'<th colspan="3">';
773 $result .= $langs->trans(
"SuppliersDraftInvoices");
775 $result .=
'<span class="badge marginleftonly">'.$num.
'</span>';
781 $companystatic =
new Societe($db);
786 while ($i < $nbofloop) {
787 $obj = $db->fetch_object($resql);
789 if ($i >= $maxCount) {
792 $tot_ttc += $obj->total_ttc;
796 $facturesupplierstatic->ref = $obj->ref;
797 $facturesupplierstatic->id = $obj->rowid;
798 $facturesupplierstatic->total_ht = $obj->total_ht;
799 $facturesupplierstatic->total_tva = $obj->total_tva;
800 $facturesupplierstatic->total_ttc = $obj->total_ttc;
801 $facturesupplierstatic->ref_supplier = $obj->ref_supplier;
802 $facturesupplierstatic->type = $obj->type;
803 $facturesupplierstatic->statut = $obj->status;
804 $facturesupplierstatic->status = $obj->status;
805 $facturesupplierstatic->paye = $obj->paye;
806 $facturesupplierstatic->paid = $obj->paye;
808 $companystatic->id = $obj->socid;
809 $companystatic->name = $obj->name;
810 $companystatic->email = $obj->email;
811 $companystatic->country_id = $obj->country_id;
812 $companystatic->country_code = $obj->country_code;
813 $companystatic->fournisseur = 1;
814 $companystatic->code_client = $obj->code_client;
815 $companystatic->code_fournisseur = $obj->code_fournisseur;
816 $companystatic->code_compta = $obj->code_compta;
817 $companystatic->code_compta_client = $obj->code_compta;
818 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
820 $result .=
'<tr class="oddeven">';
821 $result .=
'<td class="nowrap tdoverflowmax100">';
822 $result .= $facturesupplierstatic->getNomUrl(1,
'');
824 $result .=
'<td class="nowrap tdoverflowmax100">';
825 $result .= $companystatic->getNomUrl(1,
'supplier');
827 $result .=
'<td class="right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
829 $tot_ttc += $obj->total_ttc;
834 $result .=
'<tr class="oddeven">';
835 $result .=
'<td class="nowrap" colspan="3">';
836 $result .=
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
838 $result .=
"</tr>\n";
841 $result .=
'<tr class="liste_total"><td class="left">'.$langs->trans(
"Total").
'</td>';
842 $result .=
'<td colspan="2" class="right">'.price($tot_ttc).
'</td>';
845 $result .=
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</span></td></tr>';
847 $result .=
"</table></div>";
850 dol_print_error($db);
867 global
$conf, $db, $langs, $user;
868 if ($user->socid > 0) {
869 $socid = $user->socid;
871 $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,";
872 $sql .=
" s.nom as socname, s.rowid as socid, s.canvas, s.client";
873 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
874 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
875 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
876 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
878 $sql .=
" WHERE f.fk_soc = s.rowid";
879 $sql .=
" AND f.entity IN (".getEntity(
'facture').
")";
881 $sql .=
" AND f.fk_soc = ".((int) $socid);
883 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
884 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
886 $sql .=
" ORDER BY f.tms DESC";
887 $sql .= $db->plimit($maxCount, 0);
889 $resql = $db->query($sql);
891 dol_print_error($db);
894 $num = $db->num_rows($resql);
896 $result =
'<div class="div-table-responsive-no-min">';
897 $result .=
'<table class="noborder centpercent">';
899 $result .=
'<tr class="liste_titre">';
900 $result .=
'<th colspan="3">'.$langs->trans(
"LastCustomersBills", $maxCount).
'</th>';
901 $result .=
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
902 $result .=
'<th class="right"></th>';
906 $result .=
'</table>';
912 $objectstatic =
new Facture($db);
913 $companystatic =
new Societe($db);
917 $obj = $db->fetch_object($resql);
919 $objectstatic->id = $obj->rowid;
920 $objectstatic->ref = $obj->ref;
921 $objectstatic->paye = $obj->paye;
922 $objectstatic->statut = $obj->status;
923 $objectstatic->status = $obj->status;
924 $objectstatic->total_ht = $obj->total_ht;
925 $objectstatic->total_tva = $obj->total_tva;
926 $objectstatic->total_ttc = $obj->total_ttc;
927 $objectstatic->type = $obj->type;
929 $companystatic->id = $obj->socid;
930 $companystatic->name = $obj->socname;
931 $companystatic->client = $obj->client;
932 $companystatic->canvas = $obj->canvas;
935 $filedir =
$conf->propal->multidir_output[$obj->entity].
'/'.$filename;
937 $result .=
'<tr class="oddeven">';
939 $result .=
'<td class="nowrap">';
940 $result .=
'<table class="nobordernopadding">';
941 $result .=
'<tr class="nocellnopadd">';
943 $result .=
'<td width="96" class="nobordernopadding nowrap">'.$objectstatic->getNomUrl(1).
'</td>';
944 $result .=
'<td width="16" class="nobordernopadding nowrap"> </td>';
945 $result .=
'<td width="16" class="nobordernopadding right">'.$formfile->getDocumentsLink($objectstatic->element, $filename, $filedir).
'</td>';
948 $result .=
'</table>';
951 $result .=
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
952 $result .=
'<td title="'.dol_print_date($db->jdate($obj->datec),
'day').
'">'.
dol_print_date($db->jdate($obj->datec),
'day').
'</td>';
953 $result .=
'<td class="right amount">'.price($obj->total_ttc).
'</td>';
956 $payment = $objectstatic->getSommePaiement();
957 $result .=
'<td class="right">'.$objectstatic->getLibStatut(3, $payment).
'</td>';
964 $result .=
'</table>';
978 global
$conf, $db, $langs, $user;
979 if ($user->socid > 0) {
980 $socid = $user->socid;
982 $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,";
983 $sql .=
" s.nom as socname, s.rowid as socid, s.canvas, s.client";
984 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
985 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
986 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
987 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
989 $sql .=
" WHERE f.fk_soc = s.rowid";
990 $sql .=
" AND f.entity IN (".getEntity(
'facture_fourn').
")";
992 $sql .=
" AND f.fk_soc = ".((int) $socid);
994 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
995 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
997 $sql .=
" ORDER BY f.tms DESC";
998 $sql .= $db->plimit($maxCount, 0);
1000 $resql = $db->query($sql);
1002 dol_print_error($db);
1006 $num = $db->num_rows($resql);
1008 $result =
'<div class="div-table-responsive-no-min">';
1009 $result .=
'<table class="noborder centpercent">';
1010 $result .=
'<tr class="liste_titre">';
1011 $result .=
'<th colspan="3">'.$langs->trans(
"BoxTitleLastSupplierBills", $maxCount).
' ';
1012 $result .=
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/fourn/facture/list.php', [
'sortfield' =>
'f.tms',
'sortorder' =>
'DESC']).
'">';
1013 $result .=
'<span class="badge">...</span>';
1016 $result .=
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
1017 $result .=
'<th class="right"></th>';
1021 $result .=
'</table>';
1022 $result .=
'</div>';
1027 $companystatic =
new Societe($db);
1032 $obj = $db->fetch_object($resql);
1034 $objectstatic->id = $obj->rowid;
1035 $objectstatic->ref = $obj->ref;
1036 $objectstatic->paye = $obj->paye;
1037 $objectstatic->paid = $obj->paye;
1038 $objectstatic->statut = $obj->status;
1039 $objectstatic->status = $obj->status;
1040 $objectstatic->total_ht = $obj->total_ht;
1041 $objectstatic->total_tva = $obj->total_tva;
1042 $objectstatic->total_ttc = $obj->total_ttc;
1043 $objectstatic->type = $obj->type;
1045 $companystatic->id = $obj->socid;
1046 $companystatic->name = $obj->socname;
1047 $companystatic->client = $obj->client;
1048 $companystatic->canvas = $obj->canvas;
1051 $filedir =
$conf->propal->multidir_output[$obj->entity].
'/'.$filename;
1053 $result .=
'<tr class="nowrap">';
1055 $result .=
'<td class="oddeven">';
1056 $result .=
'<table class="nobordernopadding">';
1057 $result .=
'<tr class="nocellnopadd">';
1059 $result .=
'<td width="96" class="nobordernopadding nowrap">'.$objectstatic->getNomUrl(1).
'</td>';
1060 $result .=
'<td width="16" class="nobordernopadding nowrap"> </td>';
1061 $result .=
'<td width="16" class="nobordernopadding right">'.$formfile->getDocumentsLink($objectstatic->element, $filename, $filedir).
'</td>';
1064 $result .=
'</table>';
1067 $result .=
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
1069 $result .=
'<td title="'.$langs->trans(
"DateModification").
': '.
dol_print_date($db->jdate($obj->datec),
'dayhour').
'">'.
dol_print_date($db->jdate($obj->datec),
'day').
'</td>';
1071 $result .=
'<td class="amount right">'.price($obj->total_ttc).
'</td>';
1073 $result .=
'<td class="right">'.$objectstatic->getLibStatut(3).
'</td>';
1080 $result .=
'</table>';
1081 $result .=
'</div>';
1094 global
$conf, $db, $langs, $user, $hookmanager;
1098 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
1099 if ($user->socid > 0) {
1100 $socid = $user->socid;
1102 $tmpinvoice =
new Facture($db);
1104 $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";
1105 $sql .=
", f.date_lim_reglement as datelimite";
1106 $sql .=
", s.nom as name";
1107 $sql .=
", s.rowid as socid, s.email";
1108 $sql .=
", s.code_client, s.code_compta";
1109 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
1110 $sql .=
", cc.rowid as country_id, cc.code as country_code";
1111 $sql .=
", sum(pf.amount) as am";
1112 $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";
1113 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiement_facture as pf on f.rowid=pf.fk_facture";
1114 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1115 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
1117 $sql .=
" WHERE s.rowid = f.fk_soc AND f.paye = 0 AND f.fk_statut = ".Facture::STATUS_VALIDATED;
1118 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
')';
1119 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1120 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1123 $sql .=
" AND f.fk_soc = ".((int) $socid);
1126 $parameters = array();
1127 $reshook = $hookmanager->executeHooks(
'printFieldListWhereCustomerUnpaid', $parameters);
1128 $sql .= $hookmanager->resPrint;
1130 $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,";
1131 $sql .=
" s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code";
1132 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
1133 $sql .=
" ORDER BY f.datef ASC, f.ref ASC";
1135 $resql = $db->query($sql);
1137 $num = $db->num_rows($resql);
1143 print
'<div class="div-table-responsive-no-min">';
1144 print
'<table class="noborder centpercent">';
1146 print
'<tr class="liste_titre">';
1147 print
'<th colspan="2">';
1148 print $langs->trans(
"BillsCustomersUnpaid", $num).
' ';
1150 print
'<span class="badge">'.$num.
'</span>';
1154 print
'<th class="right">'.$langs->trans(
"DateDue").
'</th>';
1156 print
'<th class="right">'.$langs->trans(
"AmountHT").
'</th>';
1158 print
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
1159 print
'<th class="right">'.$langs->trans(
"Received").
'</th>';
1160 print
'<th width="16"> </th>';
1163 $societestatic =
new Societe($db);
1164 $total_ttc = $totalam = $total = 0;
1166 $obj = $db->fetch_object($resql);
1168 if ($i >= $maxCount) {
1171 $total += $obj->total_ht;
1172 $total_ttc += $obj->total_ttc;
1173 $totalam += $obj->am;
1177 $tmpinvoice->ref = $obj->ref;
1178 $tmpinvoice->id = $obj->rowid;
1179 $tmpinvoice->total_ht = $obj->total_ht;
1180 $tmpinvoice->total_tva = $obj->total_tva;
1181 $tmpinvoice->total_ttc = $obj->total_ttc;
1182 $tmpinvoice->type = $obj->type;
1183 $tmpinvoice->statut = $obj->status;
1184 $tmpinvoice->paye = $obj->paye;
1185 $tmpinvoice->date_lim_reglement = $db->jdate($obj->datelimite);
1187 $societestatic->id = $obj->socid;
1188 $societestatic->name = $obj->name;
1189 $societestatic->email = $obj->email;
1190 $societestatic->country_id = $obj->country_id;
1191 $societestatic->country_code = $obj->country_code;
1192 $societestatic->client = 1;
1193 $societestatic->code_client = $obj->code_client;
1194 $societestatic->code_fournisseur = $obj->code_fournisseur;
1195 $societestatic->code_compta = $obj->code_compta;
1196 $societestatic->code_compta_client = $obj->code_compta;
1197 $societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1199 print
'<tr class="oddeven">';
1200 print
'<td class="nowrap">';
1202 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1203 print
'<td class="nobordernopadding nowrap">';
1204 print $tmpinvoice->getNomUrl(1,
'');
1206 print
'<td width="16" class="nobordernopadding hideonsmartphone right">';
1209 $urlsource = $_SERVER[
'PHP_SELF'].
'?facid='.$obj->rowid;
1210 print $formfile->getDocumentsLink($tmpinvoice->element, $filename, $filedir);
1211 print
'</td></tr></table>';
1214 print
'<td class="nowrap tdoverflowmax100">';
1215 print $societestatic->getNomUrl(1,
'customer');
1217 print
'<td class="right" title="'.dol_print_date($db->jdate($obj->datelimite),
'day').
'">';
1219 if ($tmpinvoice->hasDelay()) {
1220 print img_warning($langs->trans(
"Late"));
1224 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
'</span></td>';
1226 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
1227 print
'<td class="nowrap right"><span class="amount">'.price($obj->am).
'</span></td>';
1228 print
'<td>'.$tmpinvoice->getLibStatut(3, $obj->am).
'</td>';
1231 $total_ttc += $obj->total_ttc;
1232 $total += $obj->total_ht;
1233 $totalam += $obj->am;
1243 print
'<tr class="oddeven">';
1244 print
'<td class="nowrap" colspan="'.$colspan.
'">';
1245 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'... ('.$othernb.
')</span>';
1250 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>';
1251 print
'<td> </td>';
1253 print
'<td class="right"><span class="amount">'.price($total).
'</span></td>';
1255 print
'<td class="nowrap right"><span class="amount">'.price($total_ttc).
'</span></td>';
1256 print
'<td class="nowrap right"><span class="amount">'.price($totalam).
'</span></td>';
1257 print
'<td> </td>';
1264 print
'<tr class="oddeven"><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</td></tr>';
1266 print
'</table></div><br>';
1269 dol_print_error($db);
1286 global
$conf, $db, $langs, $user, $hookmanager;
1290 if (
isModEnabled(
"supplier_invoice") && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'read'))) {
1291 if ($user->socid > 0) {
1292 $socid = $user->socid;
1296 $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";
1297 $sql .=
", ff.date_lim_reglement";
1298 $sql .=
", s.nom as name";
1299 $sql .=
", s.rowid as socid, s.email";
1300 $sql .=
", s.code_client, s.code_compta";
1301 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
1302 $sql .=
", sum(pf.amount) as am";
1303 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"facture_fourn as ff";
1304 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
1305 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1306 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
1308 $sql .=
" WHERE s.rowid = ff.fk_soc";
1309 $sql .=
" AND ff.entity = ".((int)
$conf->entity);
1310 $sql .=
" AND ff.paye = 0";
1311 $sql .=
" AND ff.fk_statut = ".FactureFournisseur::STATUS_VALIDATED;
1312 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1313 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1316 $sql .=
" AND ff.fk_soc = ".((int) $socid);
1319 $parameters = array();
1320 $reshook = $hookmanager->executeHooks(
'printFieldListWhereSupplierUnpaid', $parameters);
1321 $sql .= $hookmanager->resPrint;
1323 $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,";
1324 $sql .=
" s.nom, s.rowid, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
1325 $sql .=
" ORDER BY ff.date_lim_reglement ASC";
1327 $resql = $db->query($sql);
1329 $num = $db->num_rows($resql);
1332 print
'<div class="div-table-responsive-no-min">';
1333 print
'<table class="noborder centpercent">';
1335 print
'<tr class="liste_titre">';
1336 print
'<th colspan="2">';
1337 print $langs->trans(
"BillsSuppliersUnpaid", $num).
' ';
1339 print
'<span class="badge">'.$num.
'</span>';
1343 print
'<th class="right">'.$langs->trans(
"DateDue").
'</th>';
1345 print
'<th class="right">'.$langs->trans(
"AmountHT").
'</th>';
1347 print
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
1348 print
'<th class="right">'.$langs->trans(
"Paid").
'</th>';
1349 print
'<th width="16"> </th>';
1352 $societestatic =
new Societe($db);
1356 $total = $total_ttc = $totalam = 0;
1358 $obj = $db->fetch_object($resql);
1360 if ($i >= $maxCount) {
1363 $total += $obj->total_ht;
1364 $total_ttc += $obj->total_ttc;
1368 $facstatic->ref = $obj->ref;
1369 $facstatic->id = $obj->rowid;
1370 $facstatic->type = $obj->type;
1371 $facstatic->total_ht = $obj->total_ht;
1372 $facstatic->total_tva = $obj->total_tva;
1373 $facstatic->total_ttc = $obj->total_ttc;
1374 $facstatic->statut = $obj->status;
1375 $facstatic->status = $obj->status;
1376 $facstatic->paid = $obj->paye;
1377 $facstatic->paye = $obj->paye;
1379 $societestatic->id = $obj->socid;
1380 $societestatic->name = $obj->name;
1381 $societestatic->email = $obj->email;
1382 $societestatic->client = 0;
1383 $societestatic->fournisseur = 1;
1384 $societestatic->code_client = $obj->code_client;
1385 $societestatic->code_fournisseur = $obj->code_fournisseur;
1386 $societestatic->code_compta = $obj->code_compta;
1387 $societestatic->code_compta_client = $obj->code_compta;
1388 $societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1390 print
'<tr class="oddeven">';
1391 print
'<td class="nowrap tdoverflowmax100">';
1392 print $facstatic->getNomUrl(1,
'');
1394 print
'<td class="nowrap tdoverflowmax100">'.$societestatic->getNomUrl(1,
'supplier').
'</td>';
1395 print
'<td class="right">'.dol_print_date($db->jdate($obj->date_lim_reglement),
'day').
'</td>';
1397 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
'</span></td>';
1399 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
1400 print
'<td class="nowrap right"><span class="amount">'.price($obj->am).
'</span></td>';
1401 print
'<td>'.$facstatic->getLibStatut(3, $obj->am).
'</td>';
1403 $total += $obj->total_ht;
1404 $total_ttc += $obj->total_ttc;
1405 $totalam += $obj->am;
1414 print
'<tr class="oddeven">';
1415 print
'<td class="nowrap" colspan="'.$colspan.
'">';
1416 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'... ('.$othernb.
')</span>';
1421 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>';
1422 print
'<td> </td>';
1424 print
'<td class="right">'.price($total).
'</td>';
1426 print
'<td class="nowrap right">'.price($total_ttc).
'</td>';
1427 print
'<td class="nowrap right">'.price($totalam).
'</td>';
1428 print
'<td> </td>';
1435 print
'<tr class="oddeven"><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</td></tr>';
1437 print
'</table></div><br>';
1439 dol_print_error($db);
if(! $sortfield) if(! $sortorder) $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.
dol_now($mode='gmt')
Return date for now.
dol_getThemeFilePath($file, $theme='')
Return the full filesystem path of a file located in the currently selected theme directory.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.
dol_setcache($memoryid, $data, $expire=0, $filecache=0, $replace=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.
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date