31require
"../main.inc.php";
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formorder.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
46$langs->loadLangs(array(
"companies",
"bills",
"orders",
"suppliers",
"propal",
"interventions",
"contracts",
"products"));
48$action =
GETPOST(
'action',
'aZ09');
49$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
50$optioncss =
GETPOST(
'optioncss',
'alpha');
55 $socid = $user->socid;
59$hookmanager->initHooks(array(
'thirdpartyconsumption',
'consumptionthirdparty',
'globalcard'));
69$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
70$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
73if (empty($page) || $page == -1) {
76$offset = $limit * $page;
83 $sortfield =
'dateprint';
88$sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
92 $search_status = implode(
',',
GETPOST(
'search_status',
'array:intcomma'));
94 $search_status =
GETPOST(
'search_status',
'intcomma');
98if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
100 $sprod_fulldescr =
'';
107$thirdTypeSelect =
GETPOST(
"third_select_id",
'aZ09');
108$type_element =
GETPOST(
'type_element') ?
GETPOST(
'type_element') :
'';
114$parameters = array(
'id' => $socid);
115$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
117 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
126$form =
new Form($db);
129$productstatic =
new Product($db);
131$title = $langs->trans(
"Referers",
$object->name);
133 $title =
$object->name.
" - ".$title;
135$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
139 dol_print_error($db);
144print
dol_get_fiche_head($head,
'consumption', $langs->trans(
"ThirdParty"), -1,
'company');
146$linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
148dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
150print
'<div class="fichecenter">';
152print
'<div class="underbanner clearboth"></div>';
153print
'<table class="border centpercent tableforfield">';
156print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
161$elementTypeArray = array();
167 print
'<tr><td class="titlefield">';
168 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
170 $tmpcheck =
$object->check_codeclient();
171 if ($tmpcheck != 0 && $tmpcheck != -5) {
172 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
175 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"facture where fk_soc = ".((int) $socid);
176 $resql = $db->query($sql);
178 dol_print_error($db);
181 $obj = $db->fetch_object($resql);
182 $nbFactsClient = $obj->nb;
183 $thirdTypeArray = array();
184 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
185 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
186 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
188 if (
isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
189 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
191 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
192 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
194 if (
isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')) {
195 $elementTypeArray[
'shipment'] = $langs->transnoentitiesnoconv(
'Shipments');
197 if (
isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
198 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
202if (
isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')) {
203 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
207 $langs->load(
"supplier_proposal");
208 print
'<tr><td class="titlefield">';
209 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
211 $tmpcheck =
$object->check_codefournisseur();
212 if ($tmpcheck != 0 && $tmpcheck != -5) {
213 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
216 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"commande_fournisseur where fk_soc = ".((int) $socid);
217 $resql = $db->query($sql);
219 dol_print_error($db);
222 $obj = $db->fetch_object($resql);
223 $nbCmdsFourn = $obj->nb;
224 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
225 if ((
isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'facture',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
226 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
228 if ((
isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'commande',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
229 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
231 if (
isModEnabled(
'reception') && $user->hasRight(
'reception',
'lire')) {
232 $langs->load(
'receptions');
233 $elementTypeArray[
'reception'] = $langs->transnoentitiesnoconv(
'Receptions');
235 if (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
236 $elementTypeArray[
'supplier_proposal'] = $langs->transnoentitiesnoconv(
'SupplierProposals');
247print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.$socid.
'">';
248print
'<input type="hidden" name="token" value="'.newToken().
'">';
251$documentstaticline =
'';
265$documentstatic =
null;
266if ($type_element ==
'fichinter') {
267 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
269 $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, ';
270 $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, ';
271 $tables_from = MAIN_DB_PREFIX.
"fichinter as f LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as d ON d.fk_fichinter = f.rowid";
272 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
273 $where .=
" AND f.entity = ".((int)
$conf->entity);
274 $dateprint =
'f.datec';
275 $doc_number =
'f.ref';
277if ($type_element ==
'invoice') {
278 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
279 $documentstatic =
new Facture($db);
280 $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, ';
281 $tables_from = MAIN_DB_PREFIX.
"facture as f,".MAIN_DB_PREFIX.
"facturedet as d";
282 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
283 $where .=
" AND d.fk_facture = f.rowid";
284 $where .=
" AND f.entity IN (".getEntity(
'invoice').
")";
285 $dateprint =
'f.datef';
286 $doc_number =
'f.ref';
287 $thirdTypeSelect =
'customer';
289if ($type_element ==
'propal') {
290 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
291 $documentstatic =
new Propal($db);
292 $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,';
293 $tables_from = MAIN_DB_PREFIX.
"propal as c,".MAIN_DB_PREFIX.
"propaldet as d";
294 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
295 $where .=
" AND d.fk_propal = c.rowid";
296 $where .=
" AND c.entity IN (".getEntity(
'propal').
")";
297 $dateprint =
'c.datep';
298 $doc_number =
'c.ref';
299 $thirdTypeSelect =
'customer';
301if ($type_element ==
'order') {
302 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
303 $langs->load(
'sendings');
304 $documentstatic =
new Commande($db);
305 $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,';
306 $tables_from = MAIN_DB_PREFIX.
"commande as c,".MAIN_DB_PREFIX.
"commandedet as d";
307 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
308 $where .=
" AND d.fk_commande = c.rowid";
309 $where .=
" AND c.entity IN (".getEntity(
'commande').
")";
310 $dateprint =
'c.date_commande';
311 $doc_number =
'c.ref';
312 $thirdTypeSelect =
'customer';
314if ($type_element ==
'shipment') {
315 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
316 $langs->load(
'sendings');
318 $sql_select =
'SELECT e.rowid as doc_id, e.ref as doc_number, \'1\' as doc_type, e.date_creation as dateprint, e.fk_statut as status, NULL as paid, e.date_delivery as delivery_planned_date,';
319 $tables_from = MAIN_DB_PREFIX.
"expedition as e,".MAIN_DB_PREFIX.
"expeditiondet as ed,".MAIN_DB_PREFIX.
"commandedet as d";
320 $where =
" WHERE e.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
321 $where .=
" AND ed.fk_expedition = e.rowid";
322 $where .=
" AND ed.element_type = 'commande' AND ed.fk_elementdet = d.rowid";
323 $where .=
" AND e.entity = ".((int)
$conf->entity);
324 $dateprint =
'e.date_creation';
325 $doc_number =
'e.ref';
326 $thirdTypeSelect =
'customer';
328if ($type_element ==
'supplier_invoice') {
329 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
331 $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, ';
332 $tables_from = MAIN_DB_PREFIX.
"facture_fourn as f,".MAIN_DB_PREFIX.
"facture_fourn_det as d";
333 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
334 $where .=
" AND d.fk_facture_fourn = f.rowid";
335 $where .=
" AND f.entity = ".((int)
$conf->entity);
336 $dateprint =
'f.datef';
337 $doc_number =
'f.ref';
338 $thirdTypeSelect =
'supplier';
340if ($type_element ==
'supplier_proposal') {
341 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
343 $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, ';
344 $tables_from = MAIN_DB_PREFIX.
"supplier_proposal as c,".MAIN_DB_PREFIX.
"supplier_proposaldet as d";
345 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
346 $where .=
" AND d.fk_supplier_proposal = c.rowid";
347 $where .=
" AND c.entity = ".((int)
$conf->entity);
348 $dateprint =
'c.date_valid';
349 $doc_number =
'c.ref';
350 $thirdTypeSelect =
'supplier';
352if ($type_element ==
'supplier_order') {
353 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
354 $langs->load(
'sendings');
356 $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, ';
357 $tables_from = MAIN_DB_PREFIX.
"commande_fournisseur as c,".MAIN_DB_PREFIX.
"commande_fournisseurdet as d";
358 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
359 $where .=
" AND d.fk_commande = c.rowid";
360 $where .=
" AND c.entity = ".((int)
$conf->entity);
361 $dateprint =
'c.date_valid';
362 $doc_number =
'c.ref';
363 $thirdTypeSelect =
'supplier';
365if ($type_element ==
'reception') {
366 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
367 $langs->loadLangs([
'sendings',
'receptions']);
369 $sql_select =
'SELECT r.rowid as doc_id, r.ref as doc_number, \'1\' as doc_type, r.date_creation as dateprint, r.fk_statut as status, NULL as paid, r.date_delivery as delivery_planned_date, ';
370 $tables_from = MAIN_DB_PREFIX.
"reception as r,".MAIN_DB_PREFIX.
"receptiondet_batch as rd,".MAIN_DB_PREFIX.
"commande_fournisseurdet as d";
371 $where =
" WHERE r.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
372 $where .=
" AND rd.fk_reception = r.rowid";
373 $where .=
" AND rd.fk_elementdet = d.rowid AND rd.element_type = 'supplier_order'";
374 $where .=
" AND r.entity = ".((int)
$conf->entity);
375 $dateprint =
'r.date_creation';
376 $doc_number =
'r.ref';
377 $thirdTypeSelect =
'supplier';
379if ($type_element ==
'contract') {
380 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
381 $documentstatic =
new Contrat($db);
383 $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,';
384 $tables_from = MAIN_DB_PREFIX.
"contrat as c,".MAIN_DB_PREFIX.
"contratdet as d";
385 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
386 $where .=
" AND d.fk_contrat = c.rowid";
387 $where .=
" AND c.entity = ".((int)
$conf->entity);
388 $dateprint =
'c.date_valid';
389 $doc_number =
'c.ref';
390 $thirdTypeSelect =
'customer';
395if (!empty($sql_select)) {
397 $parameters = array();
398 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
399 $sql .= $hookmanager->resPrint;
400 $sql .=
' d.description as description,';
401 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal' && $type_element !=
'shipment' && $type_element !=
'reception') {
402 $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, ';
404 if ($type_element ==
'supplier_proposal') {
405 $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, ';
407 if ($type_element ==
'contract') {
408 $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, ';
410 if ($type_element ==
'shipment') {
411 $sql .=
' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, ed.qty, ed.qty as prod_qty, ed.qty * d.subprice * (100 - d.remise_percent) / 100 as total_ht, ';
413 if ($type_element ==
'reception') {
414 $sql .=
' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, rd.qty, rd.qty as prod_qty, rd.qty * d.subprice * (100 - d.remise_percent) / 100 as total_ht, ';
416 if ($type_element !=
'fichinter') {
417 $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, ';
419 $sql .=
" s.rowid as socid ";
420 if ($type_element !=
'fichinter') {
421 $sql .=
", p.ref as prod_ref, p.label as product_label";
423 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".$tables_from;
424 if ($type_element !=
'fichinter') {
425 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as p ON d.fk_product = p.rowid ';
427 $parameters = array();
428 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
429 $sql .= $hookmanager->resPrint;
433 $sql .=
" AND ".$db->sanitize((
string) $doc_number).
" LIKE '%".$db->escape($sref).
"%'";
435 if ($sprod_fulldescr) {
437 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%' OR d.description LIKE '%".$db->escape(
dol_escape_htmltag($sprod_fulldescr)).
"%'";
438 if (
GETPOST(
'type_element') !=
'fichinter') {
439 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
441 if (
GETPOST(
'type_element') !=
'fichinter') {
442 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
446 if ($type_element ==
'supplier_order' && $search_status !==
'') {
447 $sql .=
" AND c.fk_statut IN (".$db->sanitize($search_status).
")";
450 $parameters = array(
'type_element' => $type_element);
451 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
452 $sql .= $hookmanager->resPrint;
454 $parameters = array();
455 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
456 $sql .= $hookmanager->resPrint;
458 $sql .= $db->order($sortfield, $sortorder);
460 $resql = $db->query($sql);
461 $totalnboflines = $db->num_rows($resql);
463 $sql .= $db->plimit($limit + 1, $offset);
469if (empty($elementTypeArray) && !
$object->client && !
$object->fournisseur) {
470 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
475$typeElementString = $form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
476$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")).
'">';
484if ($sql_select && $sql !==
'') {
485 $resql = $db->query($sql);
487 dol_print_error($db);
490 $num = $db->num_rows($resql);
492 $param =
"&socid=".urlencode((
string) ($socid)).
"&type_element=".urlencode((
string) ($type_element));
493 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
494 $param .=
'&contextpage='.urlencode($contextpage);
496 if ($limit > 0 && $limit !=
$conf->liste_limit) {
497 $param .=
'&limit='.((int) $limit);
499 if ($sprod_fulldescr) {
500 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
503 $param .=
"&sref=".urlencode($sref);
506 $param .=
"&month=".urlencode((
string) ($month));
509 $param .=
"&year=".urlencode((
string) ($year));
511 if ($search_status !==
'') {
512 $param .=
"&search_status=".urlencode($search_status);
515 $param .=
'&optioncss='.urlencode($optioncss);
518 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'nogreyscale', $limit);
520 print
'<div class="div-table-responsive-no-min">';
521 print
'<table class="liste centpercent noborder">'.
"\n";
524 print
'<tr class="liste_titre">';
525 print
'<th class="liste_titre">';
526 print
'<input class="flat width75" type="text" name="sref" value="'.$sref.
'">';
528 print
'<th class="liste_titre nowrap center valignmiddle">';
529 print $formother->select_month($month ? (
string) $month :
'-1',
'month', 1, 0,
'valignmiddle');
530 print $formother->selectyear($year ? (
string) $year :
'-1',
'year', 1, 20, 1, 0, 0,
'',
'valignmiddle maxwidth75imp marginleftonly');
533 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
534 print
'<td class="liste_titre center"></td>';
536 print
'<th class="liste_titre center parentonrightofpage">';
537 if ($type_element ==
'supplier_order') {
538 $formorder->selectSupplierOrderStatus($search_status, 1,
'search_status',
'search_status width125 onrightofpage');
541 print
'<th class="liste_titre left">';
542 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
544 print
'<th class="liste_titre center">';
546 print
'<th class="liste_titre center">';
548 $parameters = array();
549 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
550 print $hookmanager->resPrint;
551 print
'<th class="liste_titre maxwidthsearch">';
552 $searchpicto = $form->showFilterAndCheckAddButtons(0);
558 print
'<tr class="liste_titre">';
559 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
560 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'', $sortfield, $sortorder,
'center ');
562 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
563 print_liste_field_titre(
'DateDeliveryPlanned', $_SERVER[
'PHP_SELF'],
'delivery_planned_date',
'', $param,
'', $sortfield, $sortorder,
'center ');
565 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
567 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
568 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
569 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
570 $parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
571 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
572 print $hookmanager->resPrint;
576 while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) {
577 $documentstatic->id = $objp->doc_id;
578 $documentstatic->ref = $objp->doc_number;
579 $documentstatic->type = $objp->doc_type;
580 $documentstatic->fk_statut = $objp->status;
581 $documentstatic->fk_status = $objp->status;
582 $documentstatic->statut = $objp->status;
583 $documentstatic->status = $objp->status;
584 $documentstatic->paye = $objp->paid;
585 $documentstatic->alreadypaid = $objp->paid;
586 $documentstatic->totalpaid = $objp->paid;
588 if (is_object($documentstaticline)) {
589 $documentstaticline->statut = $objp->status;
590 $documentstaticline->status = $objp->status;
593 print
'<tr class="oddeven">';
594 print
'<td class="nobordernopadding nowraponall">';
595 print $documentstatic->getNomUrl(1);
597 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
599 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
600 print
'<td class="center">'.dol_print_date($db->jdate($objp->delivery_planned_date),
'day').
'</td>';
604 print
'<td class="center">';
605 if ($type_element ==
'contract') {
606 print $documentstaticline->getLibStatut(5);
607 } elseif ($documentstatic ==
null) {
609 } elseif ($type_element ==
'invoice') {
611 print $documentstatic->getLibStatut(5, $objp->paid);
612 } elseif ($type_element ==
'supplier_invoice') {
614 print $documentstatic->getLibStatut(5, $objp->paid);
616 print $documentstatic->getLibStatut(5);
621 print
'<td class="tdoverflowmax300">';
629 if ($objp->fk_product > 0) {
630 $product_static =
new Product($db);
632 $product_static->type = $objp->fk_product_type;
633 $product_static->id = $objp->fk_product;
634 $product_static->ref = $objp->ref;
635 $product_static->entity = $objp->pentity;
636 $text = $product_static->getNomUrl(1);
640 if ($objp->fk_product > 0) {
644 $prod->fetch($objp->fk_product);
646 $outputlangs = $langs;
648 if (
GETPOST(
'lang_id',
'aZ09')) {
649 $newlang =
GETPOST(
'lang_id',
'aZ09');
651 if (empty($newlang)) {
652 $newlang =
$object->default_lang;
654 if (!empty($newlang)) {
656 $outputlangs->setDefaultLang($newlang);
659 $label = (!empty(
$prod->multilangs[$outputlangs->defaultlang][
"label"])) ?
$prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
661 $label = $objp->product_label;
664 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
668 if (($objp->info_bits & 2) == 2) { ?>
669 <a href=
"<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$object->id; ?>">
672 print img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
673 if ($objp->description ==
'(DEPOSIT)') {
674 $txt = $langs->trans(
"Deposit");
675 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
676 $txt = $langs->trans(
"ExcessReceived");
677 } elseif ($objp->description ==
'(EXCESS PAID)') {
678 $txt = $langs->trans(
"ExcessPaid");
685 if ($objp->description) {
686 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
687 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
689 $discount->fetch($objp->fk_remise_except);
690 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
692 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
694 $discount->fetch($objp->fk_remise_except);
695 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
696 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
698 $discount->fetch($objp->fk_remise_except);
699 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
700 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
702 $discount->fetch($objp->fk_remise_except);
703 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
706 echo
' ('.dol_print_date($discount->datec).
')';
713 if ($objp->fk_product > 0) {
714 echo $form->textwithtooltip($text, $description, 3, 0,
'', (
string) $i, 0,
'');
721 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
724 if (!empty($objp->label) || !empty($objp->description)) {
726 $text = img_object($langs->trans(
'Service'),
'service');
728 $text = img_object($langs->trans(
'Product'),
'product');
731 if (!empty($objp->label)) {
732 $text .=
' <strong>'.$objp->label.
'</strong>';
733 echo $form->textwithtooltip($text,
dol_htmlentitiesbr($objp->description), 3, 0,
'', (
string) $i, 0,
'');
766 $objp->prod_qty = -($objp->prod_qty);
768 print
'<td class="right"><span class="amount">'.$objp->prod_qty.
'</span></td>';
769 $total_qty += $objp->prod_qty;
771 print
'<td class="right"><span class="amount">'.price($objp->total_ht).
'</span></td>';
773 $total_ht += (float) $objp->total_ht;
775 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
776 $parameters = array(
'obj' => $objp);
777 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
778 print $hookmanager->resPrint;
783 print
'<tr class="liste_total">';
784 print
'<td>'.$langs->trans(
'Total').
'</td>';
785 print
'<td colspan="3"></td>';
787 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
790 print
'<td class="right">'.$total_qty.
'</td>';
791 print
'<td class="right">'.price($total_ht).
'</td>';
792 print
'<td class="right">'.price(
price2num($total_ht / (empty($total_qty) ? 1 : $total_qty),
'MU')).
'</td>';
793 $parameters = array();
794 $reshook = $hookmanager->executeHooks(
'printFieldListTotal', $parameters, $object, $action);
795 print $hookmanager->resPrint;
800 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
803} elseif (empty($type_element) || $type_element == -1) {
804 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'', 0,
'',
'nogreyscale', $limit);
806 print
'<table class="liste centpercent noborder">'.
"\n";
808 print
'<tr class="liste_titre">';
809 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
810 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
811 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
813 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
816 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
820 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'', 0,
'',
'nogreyscale', $limit);
822 print
'<table class="liste centpercent">'.
"\n";
824 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"FeatureNotYetAvailable").
'</span></td></tr>';
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage predefined suppliers products.
Class to manage customers orders.
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 products or services.
Class to manage proposals.
Class to manage receptions.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage price ask supplier.
Class to manage translations.
societe_prepare_head(Societe $object, $subtabs='')
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
get_date_range($date_start, $date_end, $format='', $outputlangs=null, $withparenthesis=1)
Format output for start and end date.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.