30require
"../main.inc.php";
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
38$langs->loadLangs(array(
"companies",
"bills",
"orders",
"suppliers",
"propal",
"interventions",
"contracts",
"products"));
41$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
44$socid =
GETPOST(
'socid',
'int');
46 $socid = $user->socid;
51 $object->fetch($socid);
55$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
56$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
57$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
58$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
59$optioncss =
GETPOST(
'optioncss',
'alpha');
61if (empty($page) || $page == -1) {
64$offset = $limit * $page;
71 $sortfield =
'dateprint';
76$sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
77$month =
GETPOST(
'month',
'int');
81if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
83 $sprod_fulldescr =
'';
89$thirdTypeSelect =
GETPOST(
"third_select_id",
'aZ09');
90$type_element =
GETPOST(
'type_element') ?
GETPOST(
'type_element') :
'';
94$hookmanager->initHooks(array(
'consumptionthirdparty',
'globalcard'));
101$parameters = array(
'id'=>$socid);
102$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
113$form =
new Form($db);
115$productstatic =
new Product($db);
117$title = $langs->trans(
"Referers", $object->name);
118if (
getDolGlobalString(
'MAIN_HTML_TITLE') && preg_match(
'/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
119 $title = $object->name.
" - ".$title;
121$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
130print
dol_get_fiche_head($head,
'consumption', $langs->trans(
"ThirdParty"), -1,
'company');
132$linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
134dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
136print
'<div class="fichecenter">';
138print
'<div class="underbanner clearboth"></div>';
139print
'<table class="border centpercent tableforfield">';
142print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
143print $object->getTypeUrl(1);
147 print
'<tr><td class="titlefield">'.$langs->trans(
'Prefix').
'</td><td colspan="3">'.$object->prefix_comm.
'</td></tr>';
151$elementTypeArray = array();
153if ($object->client) {
154 print
'<tr><td class="titlefield">';
155 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
157 $tmpcheck = $object->check_codeclient();
158 if ($tmpcheck != 0 && $tmpcheck != -5) {
159 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
162 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"facture where fk_soc = ".((int) $socid);
163 $resql = $db->query($sql);
168 $obj = $db->fetch_object($resql);
169 $nbFactsClient = $obj->nb;
170 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
171 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
172 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
174 if (isModEnabled(
'commande') && $user->hasRight(
'commande',
'lire')) {
175 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
177 if (isModEnabled(
'facture') && $user->hasRight(
'facture',
'lire')) {
178 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
180 if (isModEnabled(
'contrat') && $user->hasRight(
'contrat',
'lire')) {
181 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
185if (isModEnabled(
'ficheinter') && $user->hasRight(
'ficheinter',
'lire')) {
186 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
189if ($object->fournisseur) {
190 $langs->load(
"supplier_proposal");
191 print
'<tr><td class="titlefield">';
192 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
194 $tmpcheck = $object->check_codefournisseur();
195 if ($tmpcheck != 0 && $tmpcheck != -5) {
196 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
199 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"commande_fournisseur where fk_soc = ".((int) $socid);
200 $resql = $db->query($sql);
205 $obj = $db->fetch_object($resql);
206 $nbCmdsFourn = $obj->nb;
207 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
208 if ((isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'facture',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
209 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
211 if ((isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'commande',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
212 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
214 if (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
215 $elementTypeArray[
'supplier_proposal'] = $langs->transnoentitiesnoconv(
'SupplierProposals');
226print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.$socid.
'">';
227print
'<input type="hidden" name="token" value="'.newToken().
'">';
230$documentstaticline =
'';
241if ($type_element ==
'fichinter') {
242 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
244 $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, ';
245 $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, ';
246 $tables_from = MAIN_DB_PREFIX.
"fichinter as f LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as d ON d.fk_fichinter = f.rowid";
247 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
248 $where .=
" AND f.entity = ".$conf->entity;
249 $dateprint =
'f.datec';
250 $doc_number =
'f.ref';
252if ($type_element ==
'invoice') {
253 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
254 $documentstatic =
new Facture($db);
255 $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, ';
256 $tables_from = MAIN_DB_PREFIX.
"facture as f,".MAIN_DB_PREFIX.
"facturedet as d";
257 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
258 $where .=
" AND d.fk_facture = f.rowid";
259 $where .=
" AND f.entity IN (".getEntity(
'invoice').
")";
260 $dateprint =
'f.datef';
261 $doc_number =
'f.ref';
262 $thirdTypeSelect =
'customer';
264if ($type_element ==
'propal') {
265 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
266 $documentstatic =
new Propal($db);
267 $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,';
268 $tables_from = MAIN_DB_PREFIX.
"propal as c,".MAIN_DB_PREFIX.
"propaldet as d";
269 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
270 $where .=
" AND d.fk_propal = c.rowid";
271 $where .=
" AND c.entity = ".$conf->entity;
272 $dateprint =
'c.datep';
273 $doc_number =
'c.ref';
274 $thirdTypeSelect =
'customer';
276if ($type_element ==
'order') {
277 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
278 $langs->load(
'sendings');
279 $documentstatic =
new Commande($db);
280 $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, c.date_livraison as delivery_planned_date,';
281 $tables_from = MAIN_DB_PREFIX.
"commande as c,".MAIN_DB_PREFIX.
"commandedet as d";
282 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
283 $where .=
" AND d.fk_commande = c.rowid";
284 $where .=
" AND c.entity = ".$conf->entity;
285 $dateprint =
'c.date_commande';
286 $doc_number =
'c.ref';
287 $thirdTypeSelect =
'customer';
289if ($type_element ==
'supplier_invoice') {
290 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
292 $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, ';
293 $tables_from = MAIN_DB_PREFIX.
"facture_fourn as f,".MAIN_DB_PREFIX.
"facture_fourn_det as d";
294 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
295 $where .=
" AND d.fk_facture_fourn = f.rowid";
296 $where .=
" AND f.entity = ".$conf->entity;
297 $dateprint =
'f.datef';
298 $doc_number =
'f.ref';
299 $thirdTypeSelect =
'supplier';
301if ($type_element ==
'supplier_proposal') {
302 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
304 $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, ';
305 $tables_from = MAIN_DB_PREFIX.
"supplier_proposal as c,".MAIN_DB_PREFIX.
"supplier_proposaldet as d";
306 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
307 $where .=
" AND d.fk_supplier_proposal = c.rowid";
308 $where .=
" AND c.entity = ".$conf->entity;
309 $dateprint =
'c.date_valid';
310 $doc_number =
'c.ref';
311 $thirdTypeSelect =
'supplier';
313if ($type_element ==
'supplier_order') {
314 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
315 $langs->load(
'sendings');
317 $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, c.date_livraison as delivery_planned_date, ';
318 $tables_from = MAIN_DB_PREFIX.
"commande_fournisseur as c,".MAIN_DB_PREFIX.
"commande_fournisseurdet as d";
319 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
320 $where .=
" AND d.fk_commande = c.rowid";
321 $where .=
" AND c.entity = ".$conf->entity;
322 $dateprint =
'c.date_valid';
323 $doc_number =
'c.ref';
324 $thirdTypeSelect =
'supplier';
326if ($type_element ==
'contract') {
327 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
328 $documentstatic =
new Contrat($db);
330 $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,';
331 $tables_from = MAIN_DB_PREFIX.
"contrat as c,".MAIN_DB_PREFIX.
"contratdet as d";
332 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
333 $where .=
" AND d.fk_contrat = c.rowid";
334 $where .=
" AND c.entity = ".$conf->entity;
335 $dateprint =
'c.date_valid';
336 $doc_number =
'c.ref';
337 $thirdTypeSelect =
'customer';
340$parameters = array();
341$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
343if (!empty($sql_select)) {
345 $sql .=
' d.description as description,';
346 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal') {
347 $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, ';
349 if ($type_element ==
'supplier_proposal') {
350 $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, ';
352 if ($type_element ==
'contract') {
353 $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, ';
355 if ($type_element !=
'fichinter') {
356 $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, ';
358 $sql .=
" s.rowid as socid ";
359 if ($type_element !=
'fichinter') {
360 $sql .=
", p.ref as prod_ref, p.label as product_label";
362 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".$tables_from;
363 if ($type_element !=
'fichinter') {
364 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as p ON d.fk_product = p.rowid ';
369 $sql .=
" AND ".$doc_number.
" LIKE '%".$db->escape($sref).
"%'";
371 if ($sprod_fulldescr) {
373 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%' OR d.description LIKE '%".$db->escape(
dol_escape_htmltag($sprod_fulldescr)).
"%'";
374 if (
GETPOST(
'type_element') !=
'fichinter') {
375 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
377 if (
GETPOST(
'type_element') !=
'fichinter') {
378 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
382 $sql .= $db->order($sortfield, $sortorder);
384 $resql = $db->query($sql);
385 $totalnboflines = $db->num_rows($resql);
387 $sql .= $db->plimit($limit + 1, $offset);
393if (empty($elementTypeArray) && !$object->client && !$object->fournisseur) {
394 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
399$typeElementString = $form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
400$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")).
'">';
406 $resql = $db->query($sql);
411 $num = $db->num_rows($resql);
413 $param =
"&socid=".urlencode($socid).
"&type_element=".urlencode($type_element);
414 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
415 $param .=
'&contextpage='.urlencode($contextpage);
417 if ($limit > 0 && $limit != $conf->liste_limit) {
418 $param .=
'&limit='.((int) $limit);
420 if ($sprod_fulldescr) {
421 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
424 $param .=
"&sref=".urlencode($sref);
427 $param .=
"&month=".urlencode($month);
430 $param .=
"&year=".urlencode($year);
433 $param .=
'&optioncss='.urlencode($optioncss);
436 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'', $limit);
438 print
'<div class="div-table-responsive-no-min">';
439 print
'<table class="liste centpercent">'.
"\n";
442 print
'<tr class="liste_titre">';
443 print
'<td class="liste_titre left">';
444 print
'<input class="flat" type="text" name="sref" size="8" value="'.$sref.
'">';
446 print
'<td class="liste_titre nowrap center valignmiddle">';
447 print $formother->select_month($month ? $month : -1,
'month', 1, 0,
'valignmiddle');
448 print $formother->selectyear($year ? $year : -1,
'year', 1, 20, 1, 0, 0,
'',
'valignmiddle maxwidth75imp marginleftonly');
451 if ($type_element ==
'order' || $type_element ==
'supplier_order') {
452 print
'<td class="liste_titre center"></td>';
454 print
'<td class="liste_titre center">';
456 print
'<td class="liste_titre left">';
457 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
459 print
'<td class="liste_titre center">';
461 print
'<td class="liste_titre center">';
463 print
'<td class="liste_titre maxwidthsearch">';
464 $searchpicto = $form->showFilterAndCheckAddButtons(0);
470 print
'<tr class="liste_titre">';
471 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
472 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'', $sortfield, $sortorder,
'center ');
474 if ($type_element ==
'order' || $type_element ==
'supplier_order') {
475 print_liste_field_titre(
'DateDeliveryPlanned', $_SERVER[
'PHP_SELF'],
'delivery_planned_date',
'', $param,
'', $sortfield, $sortorder,
'center ');
477 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
479 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
480 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
481 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
486 while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) {
487 $documentstatic->id = $objp->doc_id;
488 $documentstatic->ref = $objp->doc_number;
489 $documentstatic->type = $objp->doc_type;
490 $documentstatic->fk_statut = $objp->status;
491 $documentstatic->fk_status = $objp->status;
492 $documentstatic->statut = $objp->status;
493 $documentstatic->status = $objp->status;
494 $documentstatic->paye = $objp->paid;
495 $documentstatic->alreadypaid = $objp->paid;
497 if (is_object($documentstaticline)) {
498 $documentstaticline->statut = $objp->status;
501 print
'<tr class="oddeven">';
502 print
'<td class="nobordernopadding nowrap" width="100">';
503 print $documentstatic->getNomUrl(1);
505 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
507 if ($type_element ==
'order' || $type_element ==
'supplier_order') {
508 print
'<td class="center">'.dol_print_date($db->jdate($objp->delivery_planned_date),
'day').
'</td>';
512 print
'<td class="center">';
513 if ($type_element ==
'contract') {
514 print $documentstaticline->getLibStatut(5);
515 } elseif ($type_element ==
'invoice') {
516 print $documentstatic->getLibStatut(5, $objp->paid);
517 } elseif ($type_element ==
'supplier_invoice') {
518 print $documentstatic->getLibStatut(5, $objp->paid);
520 print $documentstatic->getLibStatut(5);
525 print
'<td class="tdoverflowmax300">';
533 if ($objp->fk_product > 0) {
534 $product_static =
new Product($db);
536 $product_static->type = $objp->fk_product_type;
537 $product_static->id = $objp->fk_product;
538 $product_static->ref = $objp->ref;
539 $product_static->entity = $objp->pentity;
540 $text = $product_static->getNomUrl(1);
544 if ($objp->fk_product > 0) {
548 $prod->fetch($objp->fk_product);
550 $outputlangs = $langs;
552 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
553 $newlang =
GETPOST(
'lang_id',
'aZ09');
555 if (empty($newlang)) {
556 $newlang = $object->default_lang;
558 if (!empty($newlang)) {
560 $outputlangs->setDefaultLang($newlang);
563 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
565 $label = $objp->product_label;
568 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
572 if (($objp->info_bits & 2) == 2) { ?>
573 <a href=
"<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$object->id; ?>">
576 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
577 if ($objp->description ==
'(DEPOSIT)') {
578 $txt = $langs->trans(
"Deposit");
579 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
580 $txt = $langs->trans(
"ExcessReceived");
581 } elseif ($objp->description ==
'(EXCESS PAID)') {
582 $txt = $langs->trans(
"ExcessPaid");
589 if ($objp->description) {
590 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
591 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
593 $discount->fetch($objp->fk_remise_except);
594 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
596 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
598 $discount->fetch($objp->fk_remise_except);
599 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
600 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
602 $discount->fetch($objp->fk_remise_except);
603 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
604 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
606 $discount->fetch($objp->fk_remise_except);
607 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
610 echo
' ('.dol_print_date($discount->datec).
')';
617 if ($objp->fk_product > 0) {
618 echo $form->textwithtooltip($text, $description, 3,
'',
'', $i, 0,
'');
625 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
628 if (!empty($objp->label) || !empty($objp->description)) {
630 $text =
img_object($langs->trans(
'Service'),
'service');
632 $text =
img_object($langs->trans(
'Product'),
'product');
635 if (!empty($objp->label)) {
636 $text .=
' <strong>'.$objp->label.
'</strong>';
637 echo $form->textwithtooltip($text,
dol_htmlentitiesbr($objp->description), 3,
'',
'', $i, 0,
'');
670 $objp->prod_qty = -($objp->prod_qty);
672 print
'<td class="right"><span class="amount">'.$objp->prod_qty.
'</span></td>';
673 $total_qty += $objp->prod_qty;
675 print
'<td class="right"><span class="amount">'.price($objp->total_ht).
'</span></td>';
676 if (empty($total_ht)) {
679 $total_ht += (float) $objp->total_ht;
681 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
687 print
'<tr class="liste_total">';
688 print
'<td>'.$langs->trans(
'Total').
'</td>';
689 print
'<td colspan="3"></td>';
691 if ($type_element ==
'order' || $type_element ==
'supplier_order') {
694 print
'<td class="right">'.$total_qty.
'</td>';
695 print
'<td class="right">'.price($total_ht).
'</td>';
696 print
'<td class="right">'.price(
price2num($total_ht / (empty($total_qty) ? 1 : $total_qty),
'MU')).
'</td>';
701 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
704} elseif (empty($type_element) || $type_element == -1) {
705 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', (!empty($num) ? $num : 0),
'',
'');
707 print
'<table class="liste centpercent">'.
"\n";
709 print
'<tr class="liste_titre">';
710 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
711 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
712 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
714 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
717 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
721 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
723 print
'<table class="liste centpercent">'.
"\n";
725 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"FeatureNotYetAvailable").
'</span></td></tr>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage predefined suppliers products.
Class to manage customers orders.
Class to manage contracts.
Class to manage lines of contracts.
Class to manage absolute discounts.
Class to manage suppliers invoices.
Class to manage invoices.
const TYPE_CREDIT_NOTE
Credit note invoice.
Class to manage interventions.
Class to manage products or services.
Class to manage proposals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage price ask supplier.
Class to manage translations.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
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.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
get_date_range($date_start, $date_end, $format='', $outputlangs='', $withparenthesis=1)
Format output for start and end date.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
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.
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...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.