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, $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] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/invoice.php');
186 $head[$h][1] = $langs->trans(
"Miscellaneous");
187 $head[$h][2] =
'general';
190 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/admin/payment.php');
191 $head[$h][1] = $langs->trans(
"Payments");
192 $head[$h][2] =
'payment';
201 $head[$h][0] =
dolBuildUrl(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] =
dolBuildUrl(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] =
dolBuildUrl(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] =
dolBuildUrl(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] =
dolBuildUrl(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] =
dolBuildUrl(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] =
dolBuildUrl(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] =
dolBuildUrl(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] =
dolBuildUrl(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] =
dolBuildUrl(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] =
dolBuildUrl(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] =
dolBuildUrl(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';
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);
488 $dataseries[$i] = array($langs->transnoentitiesnoconv(
'NbOfOpenInvoices'), $obj->late30, $obj->late15, $obj->latenow, $obj->notlatenow, $obj->notlate15, $obj->notlate30);
491 if (!empty($dataseries[0])) {
492 foreach ($dataseries[0] as $key => $value) {
493 if (is_numeric($value)) {
499 $langs->trans(
'InvoiceLate30Days'),
500 $langs->trans(
'InvoiceLate15Days'),
501 $langs->trans(
'InvoiceLateMinus15Days'),
502 $mode ==
'customers' ? $langs->trans(
'InvoiceNotLate') : $langs->trans(
"InvoiceToPay"),
503 $mode ==
'customers' ? $langs->trans(
'InvoiceNotLate15Days') : $langs->trans(
"InvoiceToPay15Days"),
504 $mode ==
'customers' ? $langs->trans(
'InvoiceNotLate30Days') : $langs->trans(
"InvoiceToPay30Days"),
507 $colorseries = array($badgeStatus8, $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus11,
'-'.$badgeStatus11);
509 $result =
'<div class="div-table-responsive-no-min">';
510 $result .=
'<table class="noborder nohover centpercent">';
511 $result .=
'<tr class="liste_titre">';
512 $result .=
'<td>'.$langs->trans(
"NbOfOpenInvoices").
' - ';
513 if ($mode ==
'customers') {
514 $result .= $langs->trans(
"CustomerInvoice");
515 } elseif ($mode ==
'fourn' || $mode ==
'suppliers') {
516 $result .= $langs->trans(
"SupplierInvoice");
523 if ($conf->use_javascript_ajax) {
525 $dolgraph->SetData($dataseries);
527 $dolgraph->setLegend($legend);
529 $dolgraph->SetDataColor(array_values($colorseries));
530 $dolgraph->setShowLegend(2);
531 $dolgraph->setShowPercent(1);
532 $dolgraph->SetType(array(
'bars',
'bars',
'bars',
'bars',
'bars',
'bars'));
534 $dolgraph->setHeight(
'160');
535 $dolgraph->setWidth(
'450');
536 $dolgraph->setHideXValues(
true);
537 if ($mode ==
'customers') {
538 $dolgraph->draw(
'idgraphcustomerinvoices');
539 } elseif ($mode ==
'fourn' || $mode ==
'suppliers') {
540 $dolgraph->draw(
'idgraphfourninvoices');
544 $result .=
'<tr maxwidth="255">';
545 $result .=
'<td class="center">'.$dolgraph->show($total ? 0 : $langs->trans(
"NoOpenInvoice")).
'</td>';
551 $result .=
'</table>';
571 global $conf, $db, $langs, $user, $hookmanager;
575 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
576 if ($user->socid > 0) {
577 $socid = $user->socid;
581 $tmpinvoice =
new Facture($db);
583 $sql =
"SELECT f.rowid, f.ref, f.datef as date, f.total_ht, f.total_tva, f.total_ttc, f.ref_client";
584 $sql .=
", f.type, f.fk_statut as status, f.paye";
585 $sql .=
", s.nom as name";
586 $sql .=
", s.rowid as socid, s.email";
587 $sql .=
", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
588 $sql .=
", cc.rowid as country_id, cc.code as country_code";
589 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
590 $sql .=
", sc.fk_soc, sc.fk_user ";
592 $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";
593 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
594 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
596 $sql .=
" WHERE s.rowid = f.fk_soc AND f.fk_statut = ".Facture::STATUS_DRAFT;
597 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
598 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
599 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
603 $sql .=
" AND f.fk_soc = ".((int) $socid);
606 $parameters = array();
607 $reshook = $hookmanager->executeHooks(
'printFieldListWhereCustomerDraft', $parameters);
608 $sql .= $hookmanager->resPrint;
610 $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,";
611 $sql .=
" s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
612 $sql .=
" cc.rowid, cc.code";
613 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
614 $sql .=
", sc.fk_soc, sc.fk_user";
618 $parameters = array();
619 $reshook = $hookmanager->executeHooks(
'printFieldListGroupByCustomerDraft', $parameters);
620 $sql .= $hookmanager->resPrint;
622 $resql = $db->query($sql);
625 $num = $db->num_rows($resql);
626 $nbofloop = min($num, $maxofloop);
628 $result .=
'<div class="div-table-responsive-no-min">';
629 $result .=
'<table class="noborder centpercent">';
631 $result .=
'<tr class="liste_titre">';
632 $result .=
'<th colspan="3">';
633 $result .= $langs->trans(
"CustomersDraftInvoices");
634 $result .=
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/compta/facture/list.php', [
'search_status' =>
Facture::STATUS_DRAFT]).
'">';
635 $result .=
'<span class="badge marginleftonly">'.$num.
'</span>';
641 $companystatic =
new Societe($db);
646 while ($i < $nbofloop) {
647 $obj = $db->fetch_object($resql);
649 if ($i >= $maxCount) {
652 $tot_ttc += $obj->total_ttc;
656 $tmpinvoice->id = $obj->rowid;
657 $tmpinvoice->ref = $obj->ref;
658 $tmpinvoice->date = $db->jdate($obj->date);
659 $tmpinvoice->type = $obj->type;
660 $tmpinvoice->total_ht = $obj->total_ht;
661 $tmpinvoice->total_tva = $obj->total_tva;
662 $tmpinvoice->total_ttc = $obj->total_ttc;
663 $tmpinvoice->ref_client = $obj->ref_client;
664 $tmpinvoice->statut = $obj->status;
665 $tmpinvoice->paye = $obj->paye;
667 $companystatic->id = $obj->socid;
668 $companystatic->name = $obj->name;
669 $companystatic->email = $obj->email;
670 $companystatic->country_id = $obj->country_id;
671 $companystatic->country_code = $obj->country_code;
672 $companystatic->client = 1;
673 $companystatic->code_client = $obj->code_client;
674 $companystatic->code_fournisseur = $obj->code_fournisseur;
675 $companystatic->code_compta = $obj->code_compta;
676 $companystatic->code_compta_client = $obj->code_compta;
677 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
679 $result .=
'<tr class="oddeven">';
680 $result .=
'<td class="nowrap tdoverflowmax100">';
681 $result .= $tmpinvoice->getNomUrl(1,
'');
683 $result .=
'<td class="nowrap tdoverflowmax100">';
684 $result .= $companystatic->getNomUrl(1,
'customer');
686 $result .=
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
688 $tot_ttc += $obj->total_ttc;
693 $result .=
'<tr class="oddeven">';
694 $result .=
'<td class="nowrap" colspan="3">';
695 $result .=
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
697 $result .=
"</tr>\n";
700 $result .=
'<tr class="liste_total"><td class="left">'.$langs->trans(
"Total").
'</td>';
701 $result .=
'<td colspan="2" class="right">'.price($tot_ttc).
'</td>';
704 $result .=
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</span></td></tr>';
706 $result .=
"</table></div>";
725 global $conf, $db, $langs, $user, $hookmanager;
730 if ($user->socid > 0) {
731 $socid = $user->socid;
737 $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";
738 $sql .=
", s.nom as name";
739 $sql .=
", s.rowid as socid, s.email";
740 $sql .=
", s.code_client, s.code_compta";
741 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
742 $sql .=
", cc.rowid as country_id, cc.code as country_code";
743 $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";
744 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
745 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
747 $sql .=
" WHERE s.rowid = f.fk_soc AND f.fk_statut = ".FactureFournisseur::STATUS_DRAFT;
748 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
')';
749 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
750 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
753 $sql .=
" AND f.fk_soc = ".((int) $socid);
756 $parameters = array();
757 $reshook = $hookmanager->executeHooks(
'printFieldListWhereSupplierDraft', $parameters);
758 $sql .= $hookmanager->resPrint;
759 $resql = $db->query($sql);
762 $num = $db->num_rows($resql);
763 $nbofloop = min($num, $maxofloop);
765 $result .=
'<div class="div-table-responsive-no-min">';
766 $result .=
'<table class="noborder centpercent">';
768 $result .=
'<tr class="liste_titre">';
769 $result .=
'<th colspan="3">';
770 $result .= $langs->trans(
"SuppliersDraftInvoices");
772 $result .=
'<span class="badge marginleftonly">'.$num.
'</span>';
778 $companystatic =
new Societe($db);
783 while ($i < $nbofloop) {
784 $obj = $db->fetch_object($resql);
786 if ($i >= $maxCount) {
789 $tot_ttc += $obj->total_ttc;
793 $facturesupplierstatic->ref = $obj->ref;
794 $facturesupplierstatic->id = $obj->rowid;
795 $facturesupplierstatic->total_ht = $obj->total_ht;
796 $facturesupplierstatic->total_tva = $obj->total_tva;
797 $facturesupplierstatic->total_ttc = $obj->total_ttc;
798 $facturesupplierstatic->ref_supplier = $obj->ref_supplier;
799 $facturesupplierstatic->type = $obj->type;
800 $facturesupplierstatic->statut = $obj->status;
801 $facturesupplierstatic->status = $obj->status;
802 $facturesupplierstatic->paye = $obj->paye;
803 $facturesupplierstatic->paid = $obj->paye;
805 $companystatic->id = $obj->socid;
806 $companystatic->name = $obj->name;
807 $companystatic->email = $obj->email;
808 $companystatic->country_id = $obj->country_id;
809 $companystatic->country_code = $obj->country_code;
810 $companystatic->fournisseur = 1;
811 $companystatic->code_client = $obj->code_client;
812 $companystatic->code_fournisseur = $obj->code_fournisseur;
813 $companystatic->code_compta = $obj->code_compta;
814 $companystatic->code_compta_client = $obj->code_compta;
815 $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
817 $result .=
'<tr class="oddeven">';
818 $result .=
'<td class="nowrap tdoverflowmax100">';
819 $result .= $facturesupplierstatic->getNomUrl(1,
'');
821 $result .=
'<td class="nowrap tdoverflowmax100">';
822 $result .= $companystatic->getNomUrl(1,
'supplier');
824 $result .=
'<td class="right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
826 $tot_ttc += $obj->total_ttc;
831 $result .=
'<tr class="oddeven">';
832 $result .=
'<td class="nowrap" colspan="3">';
833 $result .=
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
835 $result .=
"</tr>\n";
838 $result .=
'<tr class="liste_total"><td class="left">'.$langs->trans(
"Total").
'</td>';
839 $result .=
'<td colspan="2" class="right">'.price($tot_ttc).
'</td>';
842 $result .=
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</span></td></tr>';
844 $result .=
"</table></div>";
864 global $conf, $db, $langs, $user;
865 if ($user->socid > 0) {
866 $socid = $user->socid;
868 $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,";
869 $sql .=
" s.nom as socname, s.rowid as socid, s.canvas, s.client";
870 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
871 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
872 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
873 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
875 $sql .=
" WHERE f.fk_soc = s.rowid";
876 $sql .=
" AND f.entity IN (".getEntity(
'facture').
")";
878 $sql .=
" AND f.fk_soc = ".((int) $socid);
880 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
881 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
883 $sql .=
" ORDER BY f.tms DESC";
884 $sql .= $db->plimit($maxCount, 0);
886 $resql = $db->query($sql);
891 $num = $db->num_rows($resql);
893 $result =
'<div class="div-table-responsive-no-min">';
894 $result .=
'<table class="noborder centpercent">';
896 $result .=
'<tr class="liste_titre">';
897 $result .=
'<th colspan="3">'.$langs->trans(
"LastCustomersBills", $maxCount).
'</th>';
898 $result .=
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
899 $result .=
'<th class="right"></th>';
903 $result .=
'</table>';
909 $objectstatic =
new Facture($db);
910 $companystatic =
new Societe($db);
914 $obj = $db->fetch_object($resql);
916 $objectstatic->id = $obj->rowid;
917 $objectstatic->ref = $obj->ref;
918 $objectstatic->paye = $obj->paye;
919 $objectstatic->statut = $obj->status;
920 $objectstatic->status = $obj->status;
921 $objectstatic->total_ht = $obj->total_ht;
922 $objectstatic->total_tva = $obj->total_tva;
923 $objectstatic->total_ttc = $obj->total_ttc;
924 $objectstatic->type = $obj->type;
926 $companystatic->id = $obj->socid;
927 $companystatic->name = $obj->socname;
928 $companystatic->client = $obj->client;
929 $companystatic->canvas = $obj->canvas;
932 $filedir = $conf->propal->multidir_output[$obj->entity].
'/'.$filename;
934 $result .=
'<tr class="oddeven">';
936 $result .=
'<td class="nowrap">';
937 $result .=
'<table class="nobordernopadding">';
938 $result .=
'<tr class="nocellnopadd">';
940 $result .=
'<td width="96" class="nobordernopadding nowrap">'.$objectstatic->getNomUrl(1).
'</td>';
941 $result .=
'<td width="16" class="nobordernopadding nowrap"> </td>';
942 $result .=
'<td width="16" class="nobordernopadding right">'.$formfile->getDocumentsLink($objectstatic->element, $filename, $filedir).
'</td>';
945 $result .=
'</table>';
948 $result .=
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
949 $result .=
'<td title="'.dol_print_date($db->jdate($obj->datec),
'day').
'">'.
dol_print_date($db->jdate($obj->datec),
'day').
'</td>';
950 $result .=
'<td class="right amount">'.price($obj->total_ttc).
'</td>';
953 $payment = $objectstatic->getSommePaiement();
954 $result .=
'<td class="right">'.$objectstatic->getLibStatut(3, $payment).
'</td>';
961 $result .=
'</table>';
975 global $conf, $db, $langs, $user;
976 if ($user->socid > 0) {
977 $socid = $user->socid;
979 $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,";
980 $sql .=
" s.nom as socname, s.rowid as socid, s.canvas, s.client";
981 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
982 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
983 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
984 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
986 $sql .=
" WHERE f.fk_soc = s.rowid";
987 $sql .=
" AND f.entity IN (".getEntity(
'facture_fourn').
")";
989 $sql .=
" AND f.fk_soc = ".((int) $socid);
991 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
992 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
994 $sql .=
" ORDER BY f.tms DESC";
995 $sql .= $db->plimit($maxCount, 0);
997 $resql = $db->query($sql);
1003 $num = $db->num_rows($resql);
1005 $result =
'<div class="div-table-responsive-no-min">';
1006 $result .=
'<table class="noborder centpercent">';
1007 $result .=
'<tr class="liste_titre">';
1008 $result .=
'<th colspan="3">'.$langs->trans(
"BoxTitleLastSupplierBills", $maxCount).
' ';
1009 $result .=
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/fourn/facture/list.php', [
'sortfield' =>
'f.tms',
'sortorder' =>
'DESC']).
'">';
1010 $result .=
'<span class="badge">...</span>';
1013 $result .=
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
1014 $result .=
'<th class="right"></th>';
1018 $result .=
'</table>';
1019 $result .=
'</div>';
1024 $companystatic =
new Societe($db);
1029 $obj = $db->fetch_object($resql);
1031 $objectstatic->id = $obj->rowid;
1032 $objectstatic->ref = $obj->ref;
1033 $objectstatic->paye = $obj->paye;
1034 $objectstatic->paid = $obj->paye;
1035 $objectstatic->statut = $obj->status;
1036 $objectstatic->status = $obj->status;
1037 $objectstatic->total_ht = $obj->total_ht;
1038 $objectstatic->total_tva = $obj->total_tva;
1039 $objectstatic->total_ttc = $obj->total_ttc;
1040 $objectstatic->type = $obj->type;
1042 $companystatic->id = $obj->socid;
1043 $companystatic->name = $obj->socname;
1044 $companystatic->client = $obj->client;
1045 $companystatic->canvas = $obj->canvas;
1048 $filedir = $conf->propal->multidir_output[$obj->entity].
'/'.$filename;
1050 $result .=
'<tr class="nowrap">';
1052 $result .=
'<td class="oddeven">';
1053 $result .=
'<table class="nobordernopadding">';
1054 $result .=
'<tr class="nocellnopadd">';
1056 $result .=
'<td width="96" class="nobordernopadding nowrap">'.$objectstatic->getNomUrl(1).
'</td>';
1057 $result .=
'<td width="16" class="nobordernopadding nowrap"> </td>';
1058 $result .=
'<td width="16" class="nobordernopadding right">'.$formfile->getDocumentsLink($objectstatic->element, $filename, $filedir).
'</td>';
1061 $result .=
'</table>';
1064 $result .=
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'supplier').
'</td>';
1066 $result .=
'<td title="'.$langs->trans(
"DateModification").
': '.
dol_print_date($db->jdate($obj->datec),
'dayhour').
'">'.
dol_print_date($db->jdate($obj->datec),
'day').
'</td>';
1068 $result .=
'<td class="amount right">'.price($obj->total_ttc).
'</td>';
1070 $result .=
'<td class="right">'.$objectstatic->getLibStatut(3).
'</td>';
1077 $result .=
'</table>';
1078 $result .=
'</div>';
1091 global $conf, $db, $langs, $user, $hookmanager;
1095 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
1096 if ($user->socid > 0) {
1097 $socid = $user->socid;
1099 $tmpinvoice =
new Facture($db);
1101 $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";
1102 $sql .=
", f.date_lim_reglement as datelimite";
1103 $sql .=
", s.nom as name";
1104 $sql .=
", s.rowid as socid, s.email";
1105 $sql .=
", s.code_client, s.code_compta";
1106 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
1107 $sql .=
", cc.rowid as country_id, cc.code as country_code";
1108 $sql .=
", sum(pf.amount) as am";
1109 $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";
1110 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiement_facture as pf on f.rowid=pf.fk_facture";
1111 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1112 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
1114 $sql .=
" WHERE s.rowid = f.fk_soc AND f.paye = 0 AND f.fk_statut = ".Facture::STATUS_VALIDATED;
1115 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
')';
1116 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1117 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1120 $sql .=
" AND f.fk_soc = ".((int) $socid);
1123 $parameters = array();
1124 $reshook = $hookmanager->executeHooks(
'printFieldListWhereCustomerUnpaid', $parameters);
1125 $sql .= $hookmanager->resPrint;
1127 $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,";
1128 $sql .=
" s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code";
1129 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
1130 $sql .=
" ORDER BY f.datef ASC, f.ref ASC";
1132 $resql = $db->query($sql);
1134 $num = $db->num_rows($resql);
1140 print
'<div class="div-table-responsive-no-min">';
1141 print
'<table class="noborder centpercent">';
1143 print
'<tr class="liste_titre">';
1144 print
'<th colspan="2">';
1145 print $langs->trans(
"BillsCustomersUnpaid", $num).
' ';
1147 print
'<span class="badge">'.$num.
'</span>';
1151 print
'<th class="right">'.$langs->trans(
"DateDue").
'</th>';
1153 print
'<th class="right">'.$langs->trans(
"AmountHT").
'</th>';
1155 print
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
1156 print
'<th class="right">'.$langs->trans(
"Received").
'</th>';
1157 print
'<th width="16"> </th>';
1160 $societestatic =
new Societe($db);
1161 $total_ttc = $totalam = $total = 0;
1163 $obj = $db->fetch_object($resql);
1165 if ($i >= $maxCount) {
1168 $total += $obj->total_ht;
1169 $total_ttc += $obj->total_ttc;
1170 $totalam += $obj->am;
1174 $tmpinvoice->ref = $obj->ref;
1175 $tmpinvoice->id = $obj->rowid;
1176 $tmpinvoice->total_ht = $obj->total_ht;
1177 $tmpinvoice->total_tva = $obj->total_tva;
1178 $tmpinvoice->total_ttc = $obj->total_ttc;
1179 $tmpinvoice->type = $obj->type;
1180 $tmpinvoice->statut = $obj->status;
1181 $tmpinvoice->paye = $obj->paye;
1182 $tmpinvoice->date_lim_reglement = $db->jdate($obj->datelimite);
1184 $societestatic->id = $obj->socid;
1185 $societestatic->name = $obj->name;
1186 $societestatic->email = $obj->email;
1187 $societestatic->country_id = $obj->country_id;
1188 $societestatic->country_code = $obj->country_code;
1189 $societestatic->client = 1;
1190 $societestatic->code_client = $obj->code_client;
1191 $societestatic->code_fournisseur = $obj->code_fournisseur;
1192 $societestatic->code_compta = $obj->code_compta;
1193 $societestatic->code_compta_client = $obj->code_compta;
1194 $societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1196 print
'<tr class="oddeven">';
1197 print
'<td class="nowrap">';
1199 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
1200 print
'<td class="nobordernopadding nowrap">';
1201 print $tmpinvoice->getNomUrl(1,
'');
1203 print
'<td width="16" class="nobordernopadding hideonsmartphone right">';
1206 $urlsource = $_SERVER[
'PHP_SELF'].
'?facid='.$obj->rowid;
1207 print $formfile->getDocumentsLink($tmpinvoice->element, $filename, $filedir);
1208 print
'</td></tr></table>';
1211 print
'<td class="nowrap tdoverflowmax100">';
1212 print $societestatic->getNomUrl(1,
'customer');
1214 print
'<td class="right" title="'.dol_print_date($db->jdate($obj->datelimite),
'day').
'">';
1216 if ($tmpinvoice->hasDelay()) {
1221 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
'</span></td>';
1223 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
1224 print
'<td class="nowrap right"><span class="amount">'.price($obj->am).
'</span></td>';
1225 print
'<td>'.$tmpinvoice->getLibStatut(3, $obj->am).
'</td>';
1228 $total_ttc += $obj->total_ttc;
1229 $total += $obj->total_ht;
1230 $totalam += $obj->am;
1240 print
'<tr class="oddeven">';
1241 print
'<td class="nowrap" colspan="'.$colspan.
'">';
1242 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'... ('.$othernb.
')</span>';
1247 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>';
1248 print
'<td> </td>';
1250 print
'<td class="right"><span class="amount">'.price($total).
'</span></td>';
1252 print
'<td class="nowrap right"><span class="amount">'.price($total_ttc).
'</span></td>';
1253 print
'<td class="nowrap right"><span class="amount">'.price($totalam).
'</span></td>';
1254 print
'<td> </td>';
1261 print
'<tr class="oddeven"><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</td></tr>';
1263 print
'</table></div><br>';
1283 global $conf, $db, $langs, $user, $hookmanager;
1287 if (
isModEnabled(
"supplier_invoice") && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'read'))) {
1288 if ($user->socid > 0) {
1289 $socid = $user->socid;
1293 $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";
1294 $sql .=
", ff.date_lim_reglement";
1295 $sql .=
", s.nom as name";
1296 $sql .=
", s.rowid as socid, s.email";
1297 $sql .=
", s.code_client, s.code_compta";
1298 $sql .=
", s.code_fournisseur, s.code_compta_fournisseur";
1299 $sql .=
", sum(pf.amount) as am";
1300 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"facture_fourn as ff";
1301 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
1302 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1303 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
1305 $sql .=
" WHERE s.rowid = ff.fk_soc";
1306 $sql .=
" AND ff.entity = ".$conf->entity;
1307 $sql .=
" AND ff.paye = 0";
1308 $sql .=
" AND ff.fk_statut = ".FactureFournisseur::STATUS_VALIDATED;
1309 if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
1310 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1313 $sql .=
" AND ff.fk_soc = ".((int) $socid);
1316 $parameters = array();
1317 $reshook = $hookmanager->executeHooks(
'printFieldListWhereSupplierUnpaid', $parameters);
1318 $sql .= $hookmanager->resPrint;
1320 $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,";
1321 $sql .=
" s.nom, s.rowid, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
1322 $sql .=
" ORDER BY ff.date_lim_reglement ASC";
1324 $resql = $db->query($sql);
1326 $num = $db->num_rows($resql);
1329 print
'<div class="div-table-responsive-no-min">';
1330 print
'<table class="noborder centpercent">';
1332 print
'<tr class="liste_titre">';
1333 print
'<th colspan="2">';
1334 print $langs->trans(
"BillsSuppliersUnpaid", $num).
' ';
1336 print
'<span class="badge">'.$num.
'</span>';
1340 print
'<th class="right">'.$langs->trans(
"DateDue").
'</th>';
1342 print
'<th class="right">'.$langs->trans(
"AmountHT").
'</th>';
1344 print
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
1345 print
'<th class="right">'.$langs->trans(
"Paid").
'</th>';
1346 print
'<th width="16"> </th>';
1349 $societestatic =
new Societe($db);
1353 $total = $total_ttc = $totalam = 0;
1355 $obj = $db->fetch_object($resql);
1357 if ($i >= $maxCount) {
1360 $total += $obj->total_ht;
1361 $total_ttc += $obj->total_ttc;
1365 $facstatic->ref = $obj->ref;
1366 $facstatic->id = $obj->rowid;
1367 $facstatic->type = $obj->type;
1368 $facstatic->total_ht = $obj->total_ht;
1369 $facstatic->total_tva = $obj->total_tva;
1370 $facstatic->total_ttc = $obj->total_ttc;
1371 $facstatic->statut = $obj->status;
1372 $facstatic->status = $obj->status;
1373 $facstatic->paid = $obj->paye;
1374 $facstatic->paye = $obj->paye;
1376 $societestatic->id = $obj->socid;
1377 $societestatic->name = $obj->name;
1378 $societestatic->email = $obj->email;
1379 $societestatic->client = 0;
1380 $societestatic->fournisseur = 1;
1381 $societestatic->code_client = $obj->code_client;
1382 $societestatic->code_fournisseur = $obj->code_fournisseur;
1383 $societestatic->code_compta = $obj->code_compta;
1384 $societestatic->code_compta_client = $obj->code_compta;
1385 $societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
1387 print
'<tr class="oddeven">';
1388 print
'<td class="nowrap tdoverflowmax100">';
1389 print $facstatic->getNomUrl(1,
'');
1391 print
'<td class="nowrap tdoverflowmax100">'.$societestatic->getNomUrl(1,
'supplier').
'</td>';
1392 print
'<td class="right">'.dol_print_date($db->jdate($obj->date_lim_reglement),
'day').
'</td>';
1394 print
'<td class="right"><span class="amount">'.price($obj->total_ht).
'</span></td>';
1396 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
'</span></td>';
1397 print
'<td class="nowrap right"><span class="amount">'.price($obj->am).
'</span></td>';
1398 print
'<td>'.$facstatic->getLibStatut(3, $obj->am).
'</td>';
1400 $total += $obj->total_ht;
1401 $total_ttc += $obj->total_ttc;
1402 $totalam += $obj->am;
1411 print
'<tr class="oddeven">';
1412 print
'<td class="nowrap" colspan="'.$colspan.
'">';
1413 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'... ('.$othernb.
')</span>';
1418 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>';
1419 print
'<td> </td>';
1421 print
'<td class="right">'.price($total).
'</td>';
1423 print
'<td class="nowrap right">'.price($total_ttc).
'</td>';
1424 print
'<td class="nowrap right">'.price($totalam).
'</td>';
1425 print
'<td> </td>';
1432 print
'<tr class="oddeven"><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoInvoice").
'</td></tr>';
1434 print
'</table></div><br>';
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.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dolBuildUrl($url, $params=[], $addtoken=false)
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).
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).
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.
if(getDolGlobalString( 'TAKEPOS_SHOW_CUSTOMER')) print $langs trans('Date')." left 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 PaymentTypeShortLIQ right SELECT p pos_change as p datep as date