28 require
"../main.inc.php";
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/contact.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
38 $result =
restrictedArea($user,
'contact', $id,
'socpeople&societe');
40 if ($id > 0) $object->fetch($id);
41 if (empty($object->thirdparty)) $object->fetch_thirdparty();
42 $socid = $object->thirdparty->id;
45 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
46 $sortfield =
GETPOST(
"sortfield",
'alpha');
47 $sortorder =
GETPOST(
"sortorder",
'alpha');
49 if (empty($page) || $page == -1) { $page = 0; }
50 $offset = $limit * $page;
51 $pageprev = $page - 1;
52 $pagenext = $page + 1;
53 if (!$sortorder) $sortorder =
'DESC';
54 if (!$sortfield) $sortfield =
'dateprint';
58 $sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
59 $month =
GETPOST(
'month',
'int');
63 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
66 $sprod_fulldescr =
'';
71 $thirdTypeSelect =
GETPOST(
"third_select_id");
75 $langs->loadLangs(array(
"companies",
"bills",
"orders",
"suppliers",
"propal",
"interventions",
"contracts",
"products"));
78 $hookmanager->initHooks(array(
'consumptioncontact'));
85 $parameters = array(
'id'=>$id);
86 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
87 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
93 $form =
new Form($db);
95 $productstatic =
new Product($db);
98 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"Contacts") : $langs->trans(
"ContactsAddresses"));
99 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
111 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
113 $morehtmlref =
'<div class="refidno">';
114 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
116 $objsoc->fetch($socid);
118 $morehtmlref .= $langs->trans(
'ThirdParty').
' : ';
119 if ($objsoc->id > 0) $morehtmlref .= $objsoc->getNomUrl(1,
'contact');
120 else $morehtmlref .= $langs->trans(
"ContactNotLinkedToCompany");
122 $morehtmlref .=
'</div>';
124 dol_banner_tab($object,
'id', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom', $morehtmlref);
126 print '<div class="fichecenter">';
128 print '<div class="underbanner clearboth"></div>';
129 print '<table class="border centpercent tableforfield">';
132 print '<tr><td class="titlefield">'.$langs->trans(
"UserTitle").
'</td><td>';
133 print $object->getCivilityLabel();
136 if ($object->thirdparty->client)
138 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
139 if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
140 if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
141 if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
142 if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
145 if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
147 if ($object->thirdparty->fournisseur)
149 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
150 if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
151 if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
165 print '<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'">';
166 print '<input type="hidden" name="token" value="'.newToken().
'">';
169 if ($type_element ==
'fichinter')
171 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
173 $sql_select =
'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, tc.libelle as type_contact_label, ';
174 $tables_from = MAIN_DB_PREFIX.
'fichinterdet d';
175 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'fichinter as f ON d.fk_fichinter=f.rowid';
176 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
177 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='fichinter' and tc.source='external' and tc.active=1)";
178 $where =
' WHERE f.entity IN ('.getEntity(
'ficheinter').
')';
179 $dateprint =
'f.datec';
180 $doc_number =
'f.ref';
181 } elseif ($type_element ==
'invoice')
183 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
184 $documentstatic =
new Facture($db);
185 $sql_select =
'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, tc.libelle as type_contact_label, ';
186 $tables_from = MAIN_DB_PREFIX.
'facturedet d';
187 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture as f ON d.fk_facture=f.rowid';
188 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
189 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
190 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='facture' and tc.source='external' and tc.active=1)";
191 $where =
" WHERE f.entity IN (".getEntity(
'invoice').
")";
192 $dateprint =
'f.datef';
193 $doc_number =
'f.ref';
194 $thirdTypeSelect =
'customer';
195 } elseif ($type_element ==
'propal')
197 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
198 $documentstatic =
new Propal($db);
199 $sql_select =
'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, tc.libelle as type_contact_label, ';
200 $tables_from = MAIN_DB_PREFIX.
'propaldet d';
201 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'propal as c ON d.fk_propal=c.rowid';
202 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
203 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
204 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='propal' and tc.source='external' and tc.active=1)";
205 $where =
' WHERE c.entity IN ('.getEntity(
'propal').
')';
206 $datePrint =
'c.datep';
207 $doc_number =
'c.ref';
208 $thirdTypeSelect =
'customer';
209 } elseif ($type_element ==
'order')
211 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
212 $documentstatic =
new Commande($db);
213 $sql_select =
'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, tc.libelle as type_contact_label, ';
214 $tables_from = MAIN_DB_PREFIX.
'commandedet d';
215 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON d.fk_commande=c.rowid';
216 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
217 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
218 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='commande' and tc.source='external' and tc.active=1)";
219 $where =
' WHERE c.entity IN ('.getEntity(
'order').
')';
220 $dateprint =
'c.date_commande';
221 $doc_number =
'c.ref';
222 $thirdTypeSelect =
'customer';
223 } elseif ($type_element ==
'supplier_invoice')
225 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
227 $sql_select =
'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, tc.libelle as type_contact_label, ';
228 $tables_from = MAIN_DB_PREFIX.
'facture_fourn_det d';
229 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
230 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
231 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
232 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='invoice_supplier' and tc.source='external' and tc.active=1)";
233 $where =
' WHERE f.entity IN ('.getEntity($documentstatic->element).
')';
234 $dateprint =
'f.datef';
235 $doc_number =
'f.ref';
236 $thirdTypeSelect =
'supplier';
251 elseif ($type_element ==
'supplier_order')
253 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
255 $sql_select =
'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, tc.libelle as type_contact_label, ';
256 $tables_from = MAIN_DB_PREFIX.
'commande_fournisseurdet d';
257 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande_fournisseur as c ON d.fk_commande=c.rowid';
258 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
259 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
260 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='order_supplier' and tc.source='external' and tc.active=1)";
261 $where =
' WHERE c.entity IN ('.getEntity($documentstatic->element).
')';
262 $dateprint =
'c.date_valid';
263 $doc_number =
'c.ref';
264 $thirdTypeSelect =
'supplier';
265 } elseif ($type_element ==
'contract')
267 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
268 $documentstatic =
new Contrat($db);
270 $sql_select =
'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, tc.libelle as type_contact_label, ';
271 $tables_from = MAIN_DB_PREFIX.
'contratdet d';
272 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'contrat as c ON d.fk_contrat=c.rowid';
273 $tables_from .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product p ON d.fk_product=p.rowid';
274 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
275 $tables_from .=
' INNER JOIN '.MAIN_DB_PREFIX.
"c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='contrat' and tc.source='external' and tc.active=1)";
276 $where =
' WHERE c.entity IN ('.getEntity(
'contrat').
')';
277 $dateprint =
'c.date_valid';
278 $doc_number =
'c.ref';
279 $thirdTypeSelect =
'customer';
282 $parameters = array();
283 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
285 if (!empty($sql_select))
288 $sql .=
' d.description as description';
289 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal') $sql .=
', d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
290 if ($type_element ==
'supplier_proposal') $sql .=
', d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
291 if ($type_element ==
'contract') $sql .=
', d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
292 if ($type_element !=
'fichinter') $sql .=
' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity';
294 if ($type_element !=
'fichinter') $sql .=
", p.ref as prod_ref, p.label as product_label";
295 $sql .=
" FROM ".$tables_from;
299 if ($sref) $sql .=
" AND ".$doc_number.
" LIKE '%".$db->escape($sref).
"%'";
300 if ($sprod_fulldescr)
302 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%'";
303 if (
GETPOST(
'type_element') !=
'fichinter') $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
304 if (
GETPOST(
'type_element') !=
'fichinter') $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
307 $sql .= $db->order($sortfield, $sortorder);
308 $resql = $db->query($sql);
309 $totalnboflines = $db->num_rows(
$resql);
311 $sql .= $db->plimit($limit + 1, $offset);
316 if (empty($elementTypeArray) && !$object->thirdparty->client && !$object->thirdparty->fournisseur) {
317 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
322 $typeElementString = $form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
323 $button =
'<input type="submit" class="button" name="button_third" value="'.dol_escape_htmltag($langs->trans(
"Search")).
'" title="'.
dol_escape_htmltag($langs->trans(
"Search")).
'">';
326 $param .=
"&sref=".urlencode($sref);
327 $param .=
"&month=".urlencode($month);
328 $param .=
"&year=".urlencode($year);
329 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
330 $param .=
"&socid=".urlencode($socid);
331 $param .=
"&type_element=".urlencode($type_element);
337 $resql = $db->query($sql);
340 $num = $db->num_rows(
$resql);
342 $param =
"&socid=".urlencode($socid).
"&type_element=".urlencode($type_element);
343 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
344 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
345 if ($sprod_fulldescr) $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
346 if ($sref) $param .=
"&sref=".urlencode($sref);
347 if ($month) $param .=
"&month=".urlencode($month);
348 if ($year) $param .=
"&year=".urlencode($year);
349 if ($optioncss !=
'') $param .=
'&optioncss='.urlencode($optioncss);
351 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'', $limit);
353 print '<div class="div-table-responsive-no-min">';
354 print
'<table class="liste centpercent">'.
"\n";
357 print
'<tr class="liste_titre">';
358 print
'<td class="liste_titre left">';
359 print
'<input class="flat" type="text" name="sref" size="8" value="'.$sref.
'">';
361 print
'<td class="liste_titre nowrap center">';
362 print $formother->select_month($month ? $month : -1,
'month', 1, 0,
'valignmiddle');
363 $formother->select_year($year ? $year : -1,
'year', 1, 20, 1);
365 print
'<td class="liste_titre center">';
367 print
'<td class="liste_titre left">';
368 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
370 print
'<td class="liste_titre center">';
372 print
'<td class="liste_titre center">';
374 print
'<td class="liste_titre center">';
376 print
'<td class="liste_titre maxwidthsearch">';
377 $searchpicto = $form->showFilterAndCheckAddButtons(0);
383 print
'<tr class="liste_titre">';
384 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
385 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
386 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
388 print_liste_field_titre(
'ContactType', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'left ');
389 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
390 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
391 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
396 while (($objp = $db->fetch_object(
$resql)) && $i < min($num, $limit))
398 $documentstatic->id = $objp->doc_id;
399 $documentstatic->ref = $objp->doc_number;
400 $documentstatic->type = $objp->doc_type;
401 $documentstatic->fk_statut = $objp->status;
402 $documentstatic->fk_status = $objp->status;
403 $documentstatic->statut = $objp->status;
404 $documentstatic->status = $objp->status;
405 $documentstatic->paye = $objp->paid;
406 $documentstatic->paid = $objp->paid;
408 if (is_object($documentstaticline)) $documentstaticline->statut = $objp->status;
410 print
'<tr class="oddeven">';
411 print
'<td class="nobordernopadding nowrap" width="100">';
412 print $documentstatic->getNomUrl(1);
414 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
417 print
'<td class="center">';
418 if ($type_element ==
'contract')
420 print $documentstaticline->getLibStatut(2);
422 print $documentstatic->getLibStatut(2);
429 $text =
''; $description =
''; $type = 0;
432 if ($objp->fk_product > 0)
434 $product_static =
new Product($db);
436 $product_static->type = $objp->fk_product_type;
437 $product_static->id = $objp->fk_product;
438 $product_static->ref = $objp->ref;
439 $product_static->entity = $objp->pentity;
440 $text = $product_static->getNomUrl(1);
444 if ($objp->fk_product > 0)
447 if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
450 $prod->fetch($objp->fk_product);
452 $outputlangs = $langs;
454 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) $newlang =
GETPOST(
'lang_id',
'aZ09');
455 if (empty($newlang)) $newlang = $object->default_lang;
456 if (!empty($newlang))
459 $outputlangs->setDefaultLang($newlang);
462 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
464 $label = $objp->product_label;
467 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
468 $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ?
'' :
dol_htmlentitiesbr($objp->description));
471 if (($objp->info_bits & 2) == 2)
473 print
'<a href="'.DOL_URL_ROOT.
'/comm/remx.php?id='.$object->id.
'">';
475 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
476 if ($objp->description ==
'(DEPOSIT)') $txt = $langs->trans(
"Deposit");
477 elseif ($objp->description ==
'(EXCESS RECEIVED)') $txt = $langs->trans("ExcessReceived");
478 elseif ($objp->
description == '(EXCESS PAID)') $txt = $langs->trans("ExcessPaid");
484 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0)
487 $discount->fetch($objp->fk_remise_except);
488 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
490 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0)
493 $discount->fetch($objp->fk_remise_except);
494 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
495 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0)
498 $discount->fetch($objp->fk_remise_except);
499 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
500 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0)
503 $discount->fetch($objp->fk_remise_except);
504 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
506 if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo
' ('.
dol_print_date($discount->datec).
')';
508 echo ($txt ?
' - ' :
'').dol_htmlentitiesbr($objp->description);
512 if ($objp->fk_product > 0) {
513 echo $form->textwithtooltip($text, $description, 3,
'',
'', $i, 0,
'');
519 if (!empty($conf->global->PRODUIT_DESC_IN_FORM))
521 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
524 if (!empty($objp->label) || !empty($objp->description))
526 if ($type == 1) $text =
img_object($langs->trans(
'Service'),
'service');
527 else $text =
img_object($langs->trans(
'Product'),
'product');
529 if (!empty($objp->label)) {
530 $text .=
' <strong>'.$objp->label.
'</strong>';
531 echo $form->textwithtooltip($text,
dol_htmlentitiesbr($objp->description), 3,
'',
'', $i, 0,
'');
562 print
'<td>'.$objp->type_contact_label.
'</td>';
564 print
'<td class="right">'.$objp->prod_qty.
'</td>';
565 $total_qty += $objp->prod_qty;
567 print
'<td class="right">'.price($objp->total_ht).
'</td>';
568 $total_ht += $objp->total_ht;
570 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
576 print
'<tr class="liste_total">';
577 print
'<td>'.$langs->trans(
'Total').
'</td>';
578 print
'<td colspan="3"></td>';
580 print
'<td class="right">'.$total_qty.
'</td>';
581 print
'<td class="right">'.price($total_ht).
'</td>';
582 print
'<td class="right">'.price($total_ht / (empty($total_qty) ? 1 : $total_qty)).
'</td>';
587 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
590 } elseif (empty($type_element) || $type_element == -1) {
591 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
593 print
'<table class="liste centpercent">'.
"\n";
595 print
'<tr class="liste_titre">';
596 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
597 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
598 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
600 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
603 print
'<tr class="oddeven"><td class="opacitymedium" colspan="5">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</td></tr>';
607 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
609 print
'<table class="liste centpercent">'.
"\n";
611 print
'<tr class="oddeven"><td class="opacitymedium" colspan="5">'.$langs->trans(
"FeatureNotYetAvailable").
'</td></tr>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Class to manage products or services.
Class to manage interventions.
get_date_range($date_start, $date_end, $format= '', $outputlangs= '', $withparenthesis=1)
Format output for start and end date.
Class to manage contracts.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom= 'UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
Class to manage lines of contracts.
Class to manage suppliers invoices.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Class to manage customers orders.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
Class to manage translations.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0)
Generate a SQL string to make a filter into a range (for second of date until last second of date) ...
Class to manage predefined suppliers products.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Class to manage absolute discounts.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage invoices.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
Class to manage proposals.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...