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/lib/date.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
45$langs->loadLangs(array(
"companies",
"bills",
"orders",
"suppliers",
"propal",
"interventions",
"contracts",
"products"));
47$action =
GETPOST(
'action',
'aZ09');
48$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
49$optioncss =
GETPOST(
'optioncss',
'alpha');
54 $socid = $user->socid;
58$hookmanager->initHooks(array(
'thirdpartyconsumption',
'consumptionthirdparty',
'globalcard'));
68$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
69$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
72if (empty($page) || $page == -1) {
75$offset = $limit * $page;
82 $sortfield =
'dateprint';
87$sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
92if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
94 $sprod_fulldescr =
'';
100$thirdTypeSelect =
GETPOST(
"third_select_id",
'aZ09');
101$type_element =
GETPOST(
'type_element') ?
GETPOST(
'type_element') :
'';
107$parameters = array(
'id' => $socid);
108$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
119$form =
new Form($db);
121$productstatic =
new Product($db);
123$title = $langs->trans(
"Referers",
$object->name);
125 $title =
$object->name.
" - ".$title;
127$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
136print
dol_get_fiche_head($head,
'consumption', $langs->trans(
"ThirdParty"), -1,
'company');
138$linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
140dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
142print
'<div class="fichecenter">';
144print
'<div class="underbanner clearboth"></div>';
145print
'<table class="border centpercent tableforfield">';
148print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
153$elementTypeArray = array();
156 print
'<tr><td class="titlefield">';
157 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
159 $tmpcheck =
$object->check_codeclient();
160 if ($tmpcheck != 0 && $tmpcheck != -5) {
161 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
164 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"facture where fk_soc = ".((int) $socid);
165 $resql = $db->query($sql);
170 $obj = $db->fetch_object($resql);
171 $nbFactsClient = $obj->nb;
172 $thirdTypeArray = array();
173 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
174 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
175 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
177 if (
isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
178 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
180 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
181 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
183 if (
isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')) {
184 $elementTypeArray[
'shipment'] = $langs->transnoentitiesnoconv(
'Shipments');
186 if (
isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
187 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
191if (
isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')) {
192 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
196 $langs->load(
"supplier_proposal");
197 print
'<tr><td class="titlefield">';
198 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
200 $tmpcheck =
$object->check_codefournisseur();
201 if ($tmpcheck != 0 && $tmpcheck != -5) {
202 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
205 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"commande_fournisseur where fk_soc = ".((int) $socid);
206 $resql = $db->query($sql);
211 $obj = $db->fetch_object($resql);
212 $nbCmdsFourn = $obj->nb;
213 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
214 if ((
isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'facture',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
215 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
217 if ((
isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'commande',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
218 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
220 if (
isModEnabled(
'reception') && $user->hasRight(
'reception',
'lire')) {
221 $langs->load(
'receptions');
222 $elementTypeArray[
'reception'] = $langs->transnoentitiesnoconv(
'Receptions');
224 if (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
225 $elementTypeArray[
'supplier_proposal'] = $langs->transnoentitiesnoconv(
'SupplierProposals');
236print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.$socid.
'">';
237print
'<input type="hidden" name="token" value="'.newToken().
'">';
240$documentstaticline =
'';
254$documentstatic =
null;
255if ($type_element ==
'fichinter') {
256 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
258 $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, ';
259 $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, ';
260 $tables_from = MAIN_DB_PREFIX.
"fichinter as f LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as d ON d.fk_fichinter = f.rowid";
261 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
262 $where .=
" AND f.entity = ".$conf->entity;
263 $dateprint =
'f.datec';
264 $doc_number =
'f.ref';
266if ($type_element ==
'invoice') {
267 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
268 $documentstatic =
new Facture($db);
269 $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, ';
270 $tables_from = MAIN_DB_PREFIX.
"facture as f,".MAIN_DB_PREFIX.
"facturedet as d";
271 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
272 $where .=
" AND d.fk_facture = f.rowid";
273 $where .=
" AND f.entity IN (".getEntity(
'invoice').
")";
274 $dateprint =
'f.datef';
275 $doc_number =
'f.ref';
276 $thirdTypeSelect =
'customer';
278if ($type_element ==
'propal') {
279 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
280 $documentstatic =
new Propal($db);
281 $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,';
282 $tables_from = MAIN_DB_PREFIX.
"propal as c,".MAIN_DB_PREFIX.
"propaldet as d";
283 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
284 $where .=
" AND d.fk_propal = c.rowid";
285 $where .=
" AND c.entity IN (".getEntity(
'propal').
")";
286 $dateprint =
'c.datep';
287 $doc_number =
'c.ref';
288 $thirdTypeSelect =
'customer';
290if ($type_element ==
'order') {
291 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
292 $langs->load(
'sendings');
293 $documentstatic =
new Commande($db);
294 $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,';
295 $tables_from = MAIN_DB_PREFIX.
"commande as c,".MAIN_DB_PREFIX.
"commandedet as d";
296 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
297 $where .=
" AND d.fk_commande = c.rowid";
298 $where .=
" AND c.entity IN (".getEntity(
'commande').
")";
299 $dateprint =
'c.date_commande';
300 $doc_number =
'c.ref';
301 $thirdTypeSelect =
'customer';
303if ($type_element ==
'shipment') {
304 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
305 $langs->load(
'sendings');
307 $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,';
308 $tables_from = MAIN_DB_PREFIX.
"expedition as e,".MAIN_DB_PREFIX.
"expeditiondet as ed,".MAIN_DB_PREFIX.
"commandedet as d";
309 $where =
" WHERE e.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
310 $where .=
" AND ed.fk_expedition = e.rowid";
311 $where .=
" AND ed.element_type = 'commande' AND ed.fk_elementdet = d.rowid";
312 $where .=
" AND e.entity = ".$conf->entity;
313 $dateprint =
'e.date_creation';
314 $doc_number =
'e.ref';
315 $thirdTypeSelect =
'customer';
317if ($type_element ==
'supplier_invoice') {
318 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
320 $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, ';
321 $tables_from = MAIN_DB_PREFIX.
"facture_fourn as f,".MAIN_DB_PREFIX.
"facture_fourn_det as d";
322 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
323 $where .=
" AND d.fk_facture_fourn = f.rowid";
324 $where .=
" AND f.entity = ".$conf->entity;
325 $dateprint =
'f.datef';
326 $doc_number =
'f.ref';
327 $thirdTypeSelect =
'supplier';
329if ($type_element ==
'supplier_proposal') {
330 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
332 $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, ';
333 $tables_from = MAIN_DB_PREFIX.
"supplier_proposal as c,".MAIN_DB_PREFIX.
"supplier_proposaldet as d";
334 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
335 $where .=
" AND d.fk_supplier_proposal = c.rowid";
336 $where .=
" AND c.entity = ".$conf->entity;
337 $dateprint =
'c.date_valid';
338 $doc_number =
'c.ref';
339 $thirdTypeSelect =
'supplier';
341if ($type_element ==
'supplier_order') {
342 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
343 $langs->load(
'sendings');
345 $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, ';
346 $tables_from = MAIN_DB_PREFIX.
"commande_fournisseur as c,".MAIN_DB_PREFIX.
"commande_fournisseurdet as d";
347 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
348 $where .=
" AND d.fk_commande = c.rowid";
349 $where .=
" AND c.entity = ".$conf->entity;
350 $dateprint =
'c.date_valid';
351 $doc_number =
'c.ref';
352 $thirdTypeSelect =
'supplier';
354if ($type_element ==
'reception') {
355 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
356 $langs->loadLangs([
'sendings',
'receptions']);
358 $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, ';
359 $tables_from = MAIN_DB_PREFIX.
"reception as r,".MAIN_DB_PREFIX.
"receptiondet_batch as rd,".MAIN_DB_PREFIX.
"commande_fournisseurdet as d";
360 $where =
" WHERE r.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
361 $where .=
" AND rd.fk_reception = r.rowid";
362 $where .=
" AND rd.fk_elementdet = d.rowid AND rd.element_type = 'supplier_order'";
363 $where .=
" AND r.entity = ".$conf->entity;
364 $dateprint =
'r.date_creation';
365 $doc_number =
'r.ref';
366 $thirdTypeSelect =
'supplier';
368if ($type_element ==
'contract') {
369 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
370 $documentstatic =
new Contrat($db);
372 $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,';
373 $tables_from = MAIN_DB_PREFIX.
"contrat as c,".MAIN_DB_PREFIX.
"contratdet as d";
374 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
375 $where .=
" AND d.fk_contrat = c.rowid";
376 $where .=
" AND c.entity = ".$conf->entity;
377 $dateprint =
'c.date_valid';
378 $doc_number =
'c.ref';
379 $thirdTypeSelect =
'customer';
384if (!empty($sql_select)) {
386 $parameters = array();
387 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
388 $sql .= $hookmanager->resPrint;
389 $sql .=
' d.description as description,';
390 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal' && $type_element !=
'shipment' && $type_element !=
'reception') {
391 $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, ';
393 if ($type_element ==
'supplier_proposal') {
394 $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, ';
396 if ($type_element ==
'contract') {
397 $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, ';
399 if ($type_element ==
'shipment') {
400 $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, ';
402 if ($type_element ==
'reception') {
403 $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, ';
405 if ($type_element !=
'fichinter') {
406 $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, ';
408 $sql .=
" s.rowid as socid ";
409 if ($type_element !=
'fichinter') {
410 $sql .=
", p.ref as prod_ref, p.label as product_label";
412 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".$tables_from;
413 if ($type_element !=
'fichinter') {
414 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as p ON d.fk_product = p.rowid ';
416 $parameters = array();
417 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
418 $sql .= $hookmanager->resPrint;
422 $sql .=
" AND ".$db->sanitize((
string) $doc_number).
" LIKE '%".$db->escape($sref).
"%'";
424 if ($sprod_fulldescr) {
426 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%' OR d.description LIKE '%".$db->escape(
dol_escape_htmltag($sprod_fulldescr)).
"%'";
427 if (
GETPOST(
'type_element') !=
'fichinter') {
428 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
430 if (
GETPOST(
'type_element') !=
'fichinter') {
431 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
436 $parameters = array(
'type_element' => $type_element);
437 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
438 $sql .= $hookmanager->resPrint;
440 $parameters = array();
441 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
442 $sql .= $hookmanager->resPrint;
444 $sql .= $db->order($sortfield, $sortorder);
446 $resql = $db->query($sql);
447 $totalnboflines = $db->num_rows($resql);
449 $sql .= $db->plimit($limit + 1, $offset);
455if (empty($elementTypeArray) && !
$object->client && !
$object->fournisseur) {
456 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
461$typeElementString = $form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
462$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")).
'">';
471 $resql = $db->query($sql);
476 $num = $db->num_rows($resql);
478 $param =
"&socid=".urlencode((
string) ($socid)).
"&type_element=".urlencode((
string) ($type_element));
479 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
480 $param .=
'&contextpage='.urlencode($contextpage);
482 if ($limit > 0 && $limit != $conf->liste_limit) {
483 $param .=
'&limit='.((int) $limit);
485 if ($sprod_fulldescr) {
486 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
489 $param .=
"&sref=".urlencode($sref);
492 $param .=
"&month=".urlencode((
string) ($month));
495 $param .=
"&year=".urlencode((
string) ($year));
498 $param .=
'&optioncss='.urlencode($optioncss);
501 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'nogreyscale', $limit);
503 print
'<div class="div-table-responsive-no-min">';
504 print
'<table class="liste centpercent noborder">'.
"\n";
507 print
'<tr class="liste_titre">';
508 print
'<th class="liste_titre">';
509 print
'<input class="flat width75" type="text" name="sref" value="'.$sref.
'">';
511 print
'<th class="liste_titre nowrap center valignmiddle">';
512 print $formother->select_month($month ? (
string) $month :
'-1',
'month', 1, 0,
'valignmiddle');
513 print $formother->selectyear($year ? (
string) $year :
'-1',
'year', 1, 20, 1, 0, 0,
'',
'valignmiddle maxwidth75imp marginleftonly');
516 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
517 print
'<td class="liste_titre center"></td>';
519 print
'<th class="liste_titre center">';
521 print
'<th class="liste_titre left">';
522 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
524 print
'<th class="liste_titre center">';
526 print
'<th class="liste_titre center">';
528 $parameters = array();
529 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
530 print $hookmanager->resPrint;
531 print
'<th class="liste_titre maxwidthsearch">';
532 $searchpicto = $form->showFilterAndCheckAddButtons(0);
538 print
'<tr class="liste_titre">';
539 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
540 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'', $sortfield, $sortorder,
'center ');
542 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
543 print_liste_field_titre(
'DateDeliveryPlanned', $_SERVER[
'PHP_SELF'],
'delivery_planned_date',
'', $param,
'', $sortfield, $sortorder,
'center ');
545 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
547 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
548 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
549 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
550 $parameters = array(
'param'=>$param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
551 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
552 print $hookmanager->resPrint;
556 while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) {
557 $documentstatic->id = $objp->doc_id;
558 $documentstatic->ref = $objp->doc_number;
559 $documentstatic->type = $objp->doc_type;
560 $documentstatic->fk_statut = $objp->status;
561 $documentstatic->fk_status = $objp->status;
562 $documentstatic->statut = $objp->status;
563 $documentstatic->status = $objp->status;
564 $documentstatic->paye = $objp->paid;
565 $documentstatic->alreadypaid = $objp->paid;
566 $documentstatic->totalpaid = $objp->paid;
568 if (is_object($documentstaticline)) {
569 $documentstaticline->statut = $objp->status;
570 $documentstaticline->status = $objp->status;
573 print
'<tr class="oddeven">';
574 print
'<td class="nobordernopadding nowraponall">';
575 print $documentstatic->getNomUrl(1);
577 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
579 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
580 print
'<td class="center">'.dol_print_date($db->jdate($objp->delivery_planned_date),
'day').
'</td>';
584 print
'<td class="center">';
585 if ($type_element ==
'contract') {
586 print $documentstaticline->getLibStatut(5);
587 } elseif ($documentstatic ==
null) {
589 } elseif ($type_element ==
'invoice') {
591 print $documentstatic->getLibStatut(5, $objp->paid);
592 } elseif ($type_element ==
'supplier_invoice') {
594 print $documentstatic->getLibStatut(5, $objp->paid);
596 print $documentstatic->getLibStatut(5);
601 print
'<td class="tdoverflowmax300">';
609 if ($objp->fk_product > 0) {
610 $product_static =
new Product($db);
612 $product_static->type = $objp->fk_product_type;
613 $product_static->id = $objp->fk_product;
614 $product_static->ref = $objp->ref;
615 $product_static->entity = $objp->pentity;
616 $text = $product_static->getNomUrl(1);
620 if ($objp->fk_product > 0) {
624 $prod->fetch($objp->fk_product);
626 $outputlangs = $langs;
628 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
629 $newlang =
GETPOST(
'lang_id',
'aZ09');
631 if (empty($newlang)) {
632 $newlang =
$object->default_lang;
634 if (!empty($newlang)) {
636 $outputlangs->setDefaultLang($newlang);
639 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
641 $label = $objp->product_label;
644 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
648 if (($objp->info_bits & 2) == 2) { ?>
649 <a href=
"<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$object->id; ?>">
652 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
653 if ($objp->description ==
'(DEPOSIT)') {
654 $txt = $langs->trans(
"Deposit");
655 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
656 $txt = $langs->trans(
"ExcessReceived");
657 } elseif ($objp->description ==
'(EXCESS PAID)') {
658 $txt = $langs->trans(
"ExcessPaid");
665 if ($objp->description) {
666 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
667 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
669 $discount->fetch($objp->fk_remise_except);
670 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
672 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
674 $discount->fetch($objp->fk_remise_except);
675 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
676 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
678 $discount->fetch($objp->fk_remise_except);
679 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
680 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
682 $discount->fetch($objp->fk_remise_except);
683 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
686 echo
' ('.dol_print_date($discount->datec).
')';
693 if ($objp->fk_product > 0) {
694 echo $form->textwithtooltip($text, $description, 3, 0,
'', (
string) $i, 0,
'');
701 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
704 if (!empty($objp->label) || !empty($objp->description)) {
706 $text =
img_object($langs->trans(
'Service'),
'service');
708 $text =
img_object($langs->trans(
'Product'),
'product');
711 if (!empty($objp->label)) {
712 $text .=
' <strong>'.$objp->label.
'</strong>';
713 echo $form->textwithtooltip($text,
dol_htmlentitiesbr($objp->description), 3, 0,
'', (
string) $i, 0,
'');
746 $objp->prod_qty = -($objp->prod_qty);
748 print
'<td class="right"><span class="amount">'.$objp->prod_qty.
'</span></td>';
749 $total_qty += $objp->prod_qty;
751 print
'<td class="right"><span class="amount">'.price($objp->total_ht).
'</span></td>';
753 $total_ht += (float) $objp->total_ht;
755 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
756 $parameters = array(
'obj' => $objp);
757 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
758 print $hookmanager->resPrint;
763 print
'<tr class="liste_total">';
764 print
'<td>'.$langs->trans(
'Total').
'</td>';
765 print
'<td colspan="3"></td>';
767 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
770 print
'<td class="right">'.$total_qty.
'</td>';
771 print
'<td class="right">'.price($total_ht).
'</td>';
772 print
'<td class="right">'.price(
price2num($total_ht / (empty($total_qty) ? 1 : $total_qty),
'MU')).
'</td>';
773 $parameters = array();
774 $reshook = $hookmanager->executeHooks(
'printFieldListTotal', $parameters, $object, $action);
775 print $hookmanager->resPrint;
780 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
783} elseif (empty($type_element) || $type_element == -1) {
784 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'', 0,
'',
'nogreyscale', $limit);
786 print
'<table class="liste centpercent noborder">'.
"\n";
788 print
'<tr class="liste_titre">';
789 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
790 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
791 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
793 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
796 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
800 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'', 0,
'',
'nogreyscale', $limit);
802 print
'<table class="liste centpercent">'.
"\n";
804 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)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
get_date_range($date_start, $date_end, $format='', $outputlangs=null, $withparenthesis=1)
Format output for start and end date.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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.