29 require
"../main.inc.php";
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
35 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
38 $socid =
GETPOST(
'socid',
'int');
40 $socid = $user->socid;
45 $object->fetch($socid);
49 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
50 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
51 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
53 $optioncss =
GETPOST(
'optioncss',
'alpha');
55 if (empty($page) || $page == -1) {
58 $offset = $limit * $page;
59 $pageprev = $page - 1;
60 $pagenext = $page + 1;
65 $sortfield =
'dateprint';
70 $sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
71 $month =
GETPOST(
'month',
'int');
75 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
77 $sprod_fulldescr =
'';
82 $thirdTypeSelect =
GETPOST(
"third_select_id",
'az09');
83 $type_element =
GETPOST(
'type_element') ?
GETPOST(
'type_element') :
'';
86 $langs->loadLangs(array(
"companies",
"bills",
"orders",
"suppliers",
"propal",
"interventions",
"contracts",
"products"));
89 $hookmanager->initHooks(array(
'consumptionthirdparty',
'globalcard'));
96 $parameters = array(
'id'=>$socid);
97 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
110 $productstatic =
new Product($db);
112 $title = $langs->trans(
"Referers", $object->name);
113 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
114 $title = $object->name.
" - ".$title;
116 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
125 print
dol_get_fiche_head($head,
'consumption', $langs->trans(
"ThirdParty"), -1,
'company');
127 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
129 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
131 print
'<div class="fichecenter">';
133 print
'<div class="underbanner clearboth"></div>';
134 print
'<table class="border centpercent tableforfield">';
137 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
138 print $object->getTypeUrl(1);
141 if (!empty($conf->global->SOCIETE_USEPREFIX)) {
142 print
'<tr><td class="titlefield">'.$langs->trans(
'Prefix').
'</td><td colspan="3">'.$object->prefix_comm.
'</td></tr>';
147 if ($object->client) {
148 print
'<tr><td class="titlefield">';
149 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
151 $tmpcheck = $object->check_codeclient();
152 if ($tmpcheck != 0 && $tmpcheck != -5) {
153 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
156 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"facture where fk_soc = ".((int) $socid);
157 $resql = $db->query($sql);
162 $obj = $db->fetch_object(
$resql);
163 $nbFactsClient = $obj->nb;
164 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
165 if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
166 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
168 if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
169 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
171 if (
isModEnabled(
'facture') && $user->rights->facture->lire) {
172 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
174 if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
175 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
179 if (!empty($conf->ficheinter->enabled) && !empty($user->rights->ficheinter->lire)) {
180 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
183 if ($object->fournisseur) {
184 $langs->load(
"supplier_proposal");
185 print
'<tr><td class="titlefield">';
186 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
188 $tmpcheck = $object->check_codefournisseur();
189 if ($tmpcheck != 0 && $tmpcheck != -5) {
190 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
193 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"commande_fournisseur where fk_soc = ".((int) $socid);
194 $resql = $db->query($sql);
199 $obj = $db->fetch_object(
$resql);
200 $nbCmdsFourn = $obj->nb;
201 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
202 if ((
isModEnabled(
'fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) {
203 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
205 if ((
isModEnabled(
'fournisseur') && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) {
206 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
208 if (
isModEnabled(
'supplier_proposal') && $user->rights->supplier_proposal->lire) {
209 $elementTypeArray[
'supplier_proposal'] = $langs->transnoentitiesnoconv(
'SupplierProposals');
220 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.$socid.
'">';
221 print
'<input type="hidden" name="token" value="'.newToken().
'">';
224 $documentstaticline =
'';
235 if ($type_element ==
'fichinter') {
236 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
238 $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, NULL as paid, ';
239 $sql_select .=
'NULL as fk_product, NULL as info_bits, NULL as date_start, NULL as date_end, NULL as prod_qty, NULL as total_ht, ';
240 $tables_from = MAIN_DB_PREFIX.
"fichinter as f LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as d ON d.fk_fichinter = f.rowid";
241 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
242 $where .=
" AND f.entity = ".$conf->entity;
243 $dateprint =
'f.datec';
244 $doc_number =
'f.ref';
246 if ($type_element ==
'invoice') {
247 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
248 $documentstatic =
new Facture($db);
249 $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, d.fk_remise_except, ';
250 $tables_from = MAIN_DB_PREFIX.
"facture as f,".MAIN_DB_PREFIX.
"facturedet as d";
251 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
252 $where .=
" AND d.fk_facture = f.rowid";
253 $where .=
" AND f.entity IN (".getEntity(
'invoice').
")";
254 $dateprint =
'f.datef';
255 $doc_number =
'f.ref';
256 $thirdTypeSelect =
'customer';
258 if ($type_element ==
'propal') {
259 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
260 $documentstatic =
new Propal($db);
261 $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, NULL as paid,';
262 $tables_from = MAIN_DB_PREFIX.
"propal as c,".MAIN_DB_PREFIX.
"propaldet as d";
263 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
264 $where .=
" AND d.fk_propal = c.rowid";
265 $where .=
" AND c.entity = ".$conf->entity;
266 $dateprint =
'c.datep';
267 $doc_number =
'c.ref';
268 $thirdTypeSelect =
'customer';
270 if ($type_element ==
'order') {
271 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
272 $documentstatic =
new Commande($db);
273 $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, NULL as paid, ';
274 $tables_from = MAIN_DB_PREFIX.
"commande as c,".MAIN_DB_PREFIX.
"commandedet as d";
275 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
276 $where .=
" AND d.fk_commande = c.rowid";
277 $where .=
" AND c.entity = ".$conf->entity;
278 $dateprint =
'c.date_commande';
279 $doc_number =
'c.ref';
280 $thirdTypeSelect =
'customer';
282 if ($type_element ==
'supplier_invoice') {
283 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
285 $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, ';
286 $tables_from = MAIN_DB_PREFIX.
"facture_fourn as f,".MAIN_DB_PREFIX.
"facture_fourn_det as d";
287 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
288 $where .=
" AND d.fk_facture_fourn = f.rowid";
289 $where .=
" AND f.entity = ".$conf->entity;
290 $dateprint =
'f.datef';
291 $doc_number =
'f.ref';
292 $thirdTypeSelect =
'supplier';
294 if ($type_element ==
'supplier_proposal') {
295 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
297 $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, NULL as paid, ';
298 $tables_from = MAIN_DB_PREFIX.
"supplier_proposal as c,".MAIN_DB_PREFIX.
"supplier_proposaldet as d";
299 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
300 $where .=
" AND d.fk_supplier_proposal = c.rowid";
301 $where .=
" AND c.entity = ".$conf->entity;
302 $dateprint =
'c.date_valid';
303 $doc_number =
'c.ref';
304 $thirdTypeSelect =
'supplier';
306 if ($type_element ==
'supplier_order') {
307 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
309 $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, NULL as paid, ';
310 $tables_from = MAIN_DB_PREFIX.
"commande_fournisseur as c,".MAIN_DB_PREFIX.
"commande_fournisseurdet as d";
311 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
312 $where .=
" AND d.fk_commande = c.rowid";
313 $where .=
" AND c.entity = ".$conf->entity;
314 $dateprint =
'c.date_valid';
315 $doc_number =
'c.ref';
316 $thirdTypeSelect =
'supplier';
318 if ($type_element ==
'contract') {
319 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
320 $documentstatic =
new Contrat($db);
322 $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, NULL as paid,';
323 $tables_from = MAIN_DB_PREFIX.
"contrat as c,".MAIN_DB_PREFIX.
"contratdet as d";
324 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
325 $where .=
" AND d.fk_contrat = c.rowid";
326 $where .=
" AND c.entity = ".$conf->entity;
327 $dateprint =
'c.date_valid';
328 $doc_number =
'c.ref';
329 $thirdTypeSelect =
'customer';
332 $parameters = array();
333 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
335 if (!empty($sql_select)) {
337 $sql .=
' d.description as description,';
338 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal') {
339 $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, ';
341 if ($type_element ==
'supplier_proposal') {
342 $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, ';
344 if ($type_element ==
'contract') {
345 $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, ';
347 if ($type_element !=
'fichinter') {
348 $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, ';
350 $sql .=
" s.rowid as socid ";
351 if ($type_element !=
'fichinter') {
352 $sql .=
", p.ref as prod_ref, p.label as product_label";
354 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".$tables_from;
355 if ($type_element !=
'fichinter') {
356 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as p ON d.fk_product = p.rowid ';
361 $sql .=
" AND ".$doc_number.
" LIKE '%".$db->escape($sref).
"%'";
363 if ($sprod_fulldescr) {
365 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%' OR d.description LIKE '%".$db->escape(
dol_escape_htmltag($sprod_fulldescr)).
"%'";
366 if (
GETPOST(
'type_element') !=
'fichinter') {
367 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
369 if (
GETPOST(
'type_element') !=
'fichinter') {
370 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
374 $sql .= $db->order($sortfield, $sortorder);
376 $resql = $db->query($sql);
377 $totalnboflines = $db->num_rows(
$resql);
379 $sql .= $db->plimit($limit + 1, $offset);
385 if (empty($elementTypeArray) && !$object->client && !$object->fournisseur) {
386 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
391 $typeElementString =
$form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
392 $button =
'<input type="submit" class="button buttonform small" name="button_third" value="'.dol_escape_htmltag($langs->trans(
"Search")).
'" title="'.
dol_escape_htmltag($langs->trans(
"Search")).
'">';
395 $param .=
"&sref=".urlencode($sref);
396 $param .=
"&month=".urlencode($month);
397 $param .=
"&year=".urlencode($year);
398 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
399 $param .=
"&socid=".urlencode($socid);
400 $param .=
"&type_element=".urlencode($type_element);
405 $resql = $db->query($sql);
410 $num = $db->num_rows(
$resql);
412 $param =
"&socid=".urlencode($socid).
"&type_element=".urlencode($type_element);
413 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
414 $param .=
'&contextpage='.urlencode($contextpage);
416 if ($limit > 0 && $limit != $conf->liste_limit) {
417 $param .=
'&limit='.urlencode($limit);
419 if ($sprod_fulldescr) {
420 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
423 $param .=
"&sref=".urlencode($sref);
426 $param .=
"&month=".urlencode($month);
429 $param .=
"&year=".urlencode($year);
432 $param .=
'&optioncss='.urlencode($optioncss);
435 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'', $limit);
437 print
'<div class="div-table-responsive-no-min">';
438 print
'<table class="liste centpercent">'.
"\n";
441 print
'<tr class="liste_titre">';
442 print
'<td class="liste_titre left">';
443 print
'<input class="flat" type="text" name="sref" size="8" value="'.$sref.
'">';
445 print
'<td class="liste_titre nowrap center valignmiddle">';
446 print $formother->select_month($month ? $month : -1,
'month', 1, 0,
'valignmiddle');
447 print $formother->selectyear($year ? $year : -1,
'year', 1, 20, 1, 0, 0,
'',
'valignmiddle maxwidth75imp marginleftonly');
449 print
'<td class="liste_titre center">';
451 print
'<td class="liste_titre left">';
452 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
454 print
'<td class="liste_titre center">';
456 print
'<td class="liste_titre center">';
458 print
'<td class="liste_titre maxwidthsearch">';
459 $searchpicto =
$form->showFilterAndCheckAddButtons(0);
465 print
'<tr class="liste_titre">';
466 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
467 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'', $sortfield, $sortorder,
'center ');
468 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
470 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
471 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
472 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
477 while (($objp = $db->fetch_object(
$resql)) && $i < min($num, $limit)) {
478 $documentstatic->id = $objp->doc_id;
479 $documentstatic->ref = $objp->doc_number;
480 $documentstatic->type = $objp->doc_type;
481 $documentstatic->fk_statut = $objp->status;
482 $documentstatic->fk_status = $objp->status;
483 $documentstatic->statut = $objp->status;
484 $documentstatic->status = $objp->status;
485 $documentstatic->paye = $objp->paid;
486 $documentstatic->alreadypaid = $objp->paid;
488 if (is_object($documentstaticline)) {
489 $documentstaticline->statut = $objp->status;
492 print
'<tr class="oddeven">';
493 print
'<td class="nobordernopadding nowrap" width="100">';
494 print $documentstatic->getNomUrl(1);
496 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
499 print
'<td class="center">';
500 if ($type_element ==
'contract') {
501 print $documentstaticline->getLibStatut(5);
502 } elseif ($type_element ==
'invoice') {
503 print $documentstatic->getLibStatut(5, $objp->paid);
504 } elseif ($type_element ==
'supplier_invoice') {
505 print $documentstatic->getLibStatut(5, $objp->paid);
507 print $documentstatic->getLibStatut(5);
512 print
'<td class="tdoverflowmax300">';
520 if ($objp->fk_product > 0) {
521 $product_static =
new Product($db);
523 $product_static->type = $objp->fk_product_type;
524 $product_static->id = $objp->fk_product;
525 $product_static->ref = $objp->ref;
526 $product_static->entity = $objp->pentity;
527 $text = $product_static->getNomUrl(1);
531 if ($objp->fk_product > 0) {
533 if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
535 $prod->fetch($objp->fk_product);
537 $outputlangs = $langs;
539 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
540 $newlang =
GETPOST(
'lang_id',
'aZ09');
542 if (empty($newlang)) {
543 $newlang = $object->default_lang;
545 if (!empty($newlang)) {
547 $outputlangs->setDefaultLang($newlang);
550 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
552 $label = $objp->product_label;
555 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
556 $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ?
'' :
dol_htmlentitiesbr($objp->description));
559 if (($objp->info_bits & 2) == 2) { ?>
560 <a href=
"<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$object->id; ?>">
563 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
564 if ($objp->description ==
'(DEPOSIT)') {
565 $txt = $langs->trans(
"Deposit");
566 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
567 $txt = $langs->trans(
"ExcessReceived");
568 } elseif ($objp->description ==
'(EXCESS PAID)') {
569 $txt = $langs->trans(
"ExcessPaid");
576 if ($objp->description) {
577 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
578 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
580 $discount->fetch($objp->fk_remise_except);
581 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
583 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
585 $discount->fetch($objp->fk_remise_except);
586 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
587 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
589 $discount->fetch($objp->fk_remise_except);
590 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
591 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
593 $discount->fetch($objp->fk_remise_except);
594 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
596 if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
597 echo
' ('.dol_print_date($discount->datec).
')';
600 echo ($txt ?
' - ' :
'').dol_htmlentitiesbr($objp->description);
604 if ($objp->fk_product > 0) {
605 echo
$form->textwithtooltip($text, $description, 3,
'',
'', $i, 0,
'');
611 if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
612 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
615 if (!empty($objp->label) || !empty($objp->description)) {
617 $text =
img_object($langs->trans(
'Service'),
'service');
619 $text =
img_object($langs->trans(
'Product'),
'product');
622 if (!empty($objp->label)) {
623 $text .=
' <strong>'.$objp->label.
'</strong>';
657 $objp->prod_qty = -($objp->prod_qty);
659 print
'<td class="right"><span class="amount">'.$objp->prod_qty.
'</span></td>';
660 $total_qty += $objp->prod_qty;
662 print
'<td class="right"><span class="amount">'.price($objp->total_ht).
'</span></td>';
663 if (empty($total_ht)) {
666 $total_ht += (
float) $objp->total_ht;
668 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
674 print
'<tr class="liste_total">';
675 print
'<td>'.$langs->trans(
'Total').
'</td>';
676 print
'<td colspan="3"></td>';
677 print
'<td class="right">'.$total_qty.
'</td>';
678 print
'<td class="right">'.price($total_ht).
'</td>';
679 print
'<td class="right">'.price(
price2num($total_ht / (empty($total_qty) ? 1 : $total_qty),
'MU')).
'</td>';
684 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
687 } elseif (empty($type_element) || $type_element == -1) {
688 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', (!empty($num) ? $num : 0),
'',
'');
690 print
'<table class="liste centpercent">'.
"\n";
692 print
'<tr class="liste_titre">';
693 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
694 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
695 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
697 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
700 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
704 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
706 print
'<table class="liste centpercent">'.
"\n";
708 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"FeatureNotYetAvailable").
'</span></td></tr>';