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);
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();
159 print
'<tr><td class="titlefield">';
160 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
162 $tmpcheck =
$object->check_codeclient();
163 if ($tmpcheck != 0 && $tmpcheck != -5) {
164 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
167 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"facture where fk_soc = ".((int) $socid);
168 $resql =
$db->query($sql);
173 $obj =
$db->fetch_object($resql);
174 $nbFactsClient = $obj->nb;
175 $thirdTypeArray = array();
176 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
177 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
178 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
180 if (
isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
181 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
183 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
184 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
186 if (
isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')) {
187 $elementTypeArray[
'shipment'] = $langs->transnoentitiesnoconv(
'Shipments');
189 if (
isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
190 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
194if (
isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')) {
195 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
199 $langs->load(
"supplier_proposal");
200 print
'<tr><td class="titlefield">';
201 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
203 $tmpcheck =
$object->check_codefournisseur();
204 if ($tmpcheck != 0 && $tmpcheck != -5) {
205 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
208 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"commande_fournisseur where fk_soc = ".((int) $socid);
209 $resql =
$db->query($sql);
214 $obj =
$db->fetch_object($resql);
215 $nbCmdsFourn = $obj->nb;
216 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
217 if ((
isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'facture',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
218 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
220 if ((
isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'commande',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
221 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
223 if (
isModEnabled(
'reception') && $user->hasRight(
'reception',
'lire')) {
224 $langs->load(
'receptions');
225 $elementTypeArray[
'reception'] = $langs->transnoentitiesnoconv(
'Receptions');
227 if (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
228 $elementTypeArray[
'supplier_proposal'] = $langs->transnoentitiesnoconv(
'SupplierProposals');
239print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.$socid.
'">';
240print
'<input type="hidden" name="token" value="'.newToken().
'">';
243$documentstaticline =
'';
257$documentstatic =
null;
258if ($type_element ==
'fichinter') {
259 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
261 $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, ';
262 $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, ';
263 $tables_from = MAIN_DB_PREFIX.
"fichinter as f LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as d ON d.fk_fichinter = f.rowid";
264 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
265 $where .=
" AND f.entity = ".$conf->entity;
266 $dateprint =
'f.datec';
267 $doc_number =
'f.ref';
269if ($type_element ==
'invoice') {
270 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
272 $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, ';
273 $tables_from = MAIN_DB_PREFIX.
"facture as f,".MAIN_DB_PREFIX.
"facturedet as d";
274 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
275 $where .=
" AND d.fk_facture = f.rowid";
276 $where .=
" AND f.entity IN (".getEntity(
'invoice').
")";
277 $dateprint =
'f.datef';
278 $doc_number =
'f.ref';
279 $thirdTypeSelect =
'customer';
281if ($type_element ==
'propal') {
282 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
284 $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,';
285 $tables_from = MAIN_DB_PREFIX.
"propal as c,".MAIN_DB_PREFIX.
"propaldet as d";
286 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
287 $where .=
" AND d.fk_propal = c.rowid";
288 $where .=
" AND c.entity IN (".getEntity(
'propal').
")";
289 $dateprint =
'c.datep';
290 $doc_number =
'c.ref';
291 $thirdTypeSelect =
'customer';
293if ($type_element ==
'order') {
294 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
295 $langs->load(
'sendings');
297 $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,';
298 $tables_from = MAIN_DB_PREFIX.
"commande as c,".MAIN_DB_PREFIX.
"commandedet as d";
299 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
300 $where .=
" AND d.fk_commande = c.rowid";
301 $where .=
" AND c.entity IN (".getEntity(
'commande').
")";
302 $dateprint =
'c.date_commande';
303 $doc_number =
'c.ref';
304 $thirdTypeSelect =
'customer';
306if ($type_element ==
'shipment') {
307 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
308 $langs->load(
'sendings');
310 $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,';
311 $tables_from = MAIN_DB_PREFIX.
"expedition as e,".MAIN_DB_PREFIX.
"expeditiondet as ed,".MAIN_DB_PREFIX.
"commandedet as d";
312 $where =
" WHERE e.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
313 $where .=
" AND ed.fk_expedition = e.rowid";
314 $where .=
" AND ed.element_type = 'commande' AND ed.fk_elementdet = d.rowid";
315 $where .=
" AND e.entity = ".$conf->entity;
316 $dateprint =
'e.date_creation';
317 $doc_number =
'e.ref';
318 $thirdTypeSelect =
'customer';
320if ($type_element ==
'supplier_invoice') {
321 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
323 $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, ';
324 $tables_from = MAIN_DB_PREFIX.
"facture_fourn as f,".MAIN_DB_PREFIX.
"facture_fourn_det as d";
325 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
326 $where .=
" AND d.fk_facture_fourn = f.rowid";
327 $where .=
" AND f.entity = ".$conf->entity;
328 $dateprint =
'f.datef';
329 $doc_number =
'f.ref';
330 $thirdTypeSelect =
'supplier';
332if ($type_element ==
'supplier_proposal') {
333 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
335 $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, ';
336 $tables_from = MAIN_DB_PREFIX.
"supplier_proposal as c,".MAIN_DB_PREFIX.
"supplier_proposaldet as d";
337 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
338 $where .=
" AND d.fk_supplier_proposal = c.rowid";
339 $where .=
" AND c.entity = ".$conf->entity;
340 $dateprint =
'c.date_valid';
341 $doc_number =
'c.ref';
342 $thirdTypeSelect =
'supplier';
344if ($type_element ==
'supplier_order') {
345 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
346 $langs->load(
'sendings');
348 $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, ';
349 $tables_from = MAIN_DB_PREFIX.
"commande_fournisseur as c,".MAIN_DB_PREFIX.
"commande_fournisseurdet as d";
350 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
351 $where .=
" AND d.fk_commande = c.rowid";
352 $where .=
" AND c.entity = ".$conf->entity;
353 $dateprint =
'c.date_valid';
354 $doc_number =
'c.ref';
355 $thirdTypeSelect =
'supplier';
357if ($type_element ==
'reception') {
358 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
359 $langs->loadLangs([
'sendings',
'receptions']);
361 $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, ';
362 $tables_from = MAIN_DB_PREFIX.
"reception as r,".MAIN_DB_PREFIX.
"receptiondet_batch as rd,".MAIN_DB_PREFIX.
"commande_fournisseurdet as d";
363 $where =
" WHERE r.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
364 $where .=
" AND rd.fk_reception = r.rowid";
365 $where .=
" AND rd.fk_elementdet = d.rowid AND rd.element_type = 'supplier_order'";
366 $where .=
" AND r.entity = ".$conf->entity;
367 $dateprint =
'r.date_creation';
368 $doc_number =
'r.ref';
369 $thirdTypeSelect =
'supplier';
371if ($type_element ==
'contract') {
372 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
375 $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,';
376 $tables_from = MAIN_DB_PREFIX.
"contrat as c,".MAIN_DB_PREFIX.
"contratdet as d";
377 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
378 $where .=
" AND d.fk_contrat = c.rowid";
379 $where .=
" AND c.entity = ".$conf->entity;
380 $dateprint =
'c.date_valid';
381 $doc_number =
'c.ref';
382 $thirdTypeSelect =
'customer';
387if (!empty($sql_select)) {
389 $parameters = array();
390 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
391 $sql .= $hookmanager->resPrint;
392 $sql .=
' d.description as description,';
393 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal' && $type_element !=
'shipment' && $type_element !=
'reception') {
394 $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, ';
396 if ($type_element ==
'supplier_proposal') {
397 $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, ';
399 if ($type_element ==
'contract') {
400 $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, ';
402 if ($type_element ==
'shipment') {
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, ed.qty, ed.qty as prod_qty, ed.qty * d.subprice * (100 - d.remise_percent) / 100 as total_ht, ';
405 if ($type_element ==
'reception') {
406 $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, ';
408 if ($type_element !=
'fichinter') {
409 $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, ';
411 $sql .=
" s.rowid as socid ";
412 if ($type_element !=
'fichinter') {
413 $sql .=
", p.ref as prod_ref, p.label as product_label";
415 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".$tables_from;
416 if ($type_element !=
'fichinter') {
417 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as p ON d.fk_product = p.rowid ';
419 $parameters = array();
420 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
421 $sql .= $hookmanager->resPrint;
425 $sql .=
" AND ".$db->sanitize((
string) $doc_number).
" LIKE '%".
$db->escape($sref).
"%'";
427 if ($sprod_fulldescr) {
429 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%' OR d.description LIKE '%".
$db->escape(
dol_escape_htmltag($sprod_fulldescr)).
"%'";
430 if (
GETPOST(
'type_element') !=
'fichinter') {
431 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
433 if (
GETPOST(
'type_element') !=
'fichinter') {
434 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
439 $parameters = array(
'type_element' => $type_element);
440 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
441 $sql .= $hookmanager->resPrint;
443 $parameters = array();
444 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object, $action);
445 $sql .= $hookmanager->resPrint;
447 $sql .=
$db->order($sortfield, $sortorder);
449 $resql =
$db->query($sql);
450 $totalnboflines =
$db->num_rows($resql);
452 $sql .=
$db->plimit($limit + 1, $offset);
458if (empty($elementTypeArray) && !
$object->client && !
$object->fournisseur) {
459 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
464$typeElementString = $form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
465$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")).
'">';
473if ($sql_select && $sql !==
'') {
474 $resql =
$db->query($sql);
479 $num =
$db->num_rows($resql);
481 $param =
"&socid=".urlencode((
string) ($socid)).
"&type_element=".urlencode((
string) ($type_element));
482 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
483 $param .=
'&contextpage='.urlencode($contextpage);
485 if ($limit > 0 && $limit !=
$conf->liste_limit) {
486 $param .=
'&limit='.((int) $limit);
488 if ($sprod_fulldescr) {
489 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
492 $param .=
"&sref=".urlencode($sref);
495 $param .=
"&month=".urlencode((
string) ($month));
498 $param .=
"&year=".urlencode((
string) ($year));
501 $param .=
'&optioncss='.urlencode($optioncss);
504 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'nogreyscale', $limit);
506 print
'<div class="div-table-responsive-no-min">';
507 print
'<table class="liste centpercent noborder">'.
"\n";
510 print
'<tr class="liste_titre">';
511 print
'<th class="liste_titre">';
512 print
'<input class="flat width75" type="text" name="sref" value="'.$sref.
'">';
514 print
'<th class="liste_titre nowrap center valignmiddle">';
515 print $formother->select_month($month ? (
string) $month :
'-1',
'month', 1, 0,
'valignmiddle');
516 print $formother->selectyear($year ? (
string) $year :
'-1',
'year', 1, 20, 1, 0, 0,
'',
'valignmiddle maxwidth75imp marginleftonly');
519 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
520 print
'<td class="liste_titre center"></td>';
522 print
'<th class="liste_titre center">';
524 print
'<th class="liste_titre left">';
525 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
527 print
'<th class="liste_titre center">';
529 print
'<th class="liste_titre center">';
531 $parameters = array();
532 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
533 print $hookmanager->resPrint;
534 print
'<th class="liste_titre maxwidthsearch">';
535 $searchpicto = $form->showFilterAndCheckAddButtons(0);
541 print
'<tr class="liste_titre">';
542 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
543 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'', $sortfield, $sortorder,
'center ');
545 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
546 print_liste_field_titre(
'DateDeliveryPlanned', $_SERVER[
'PHP_SELF'],
'delivery_planned_date',
'', $param,
'', $sortfield, $sortorder,
'center ');
548 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
550 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
551 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
552 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
553 $parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
554 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
555 print $hookmanager->resPrint;
559 while (($objp =
$db->fetch_object($resql)) && $i < min($num, $limit)) {
560 $documentstatic->id = $objp->doc_id;
561 $documentstatic->ref = $objp->doc_number;
562 $documentstatic->type = $objp->doc_type;
563 $documentstatic->fk_statut = $objp->status;
564 $documentstatic->fk_status = $objp->status;
565 $documentstatic->statut = $objp->status;
566 $documentstatic->status = $objp->status;
567 $documentstatic->paye = $objp->paid;
568 $documentstatic->alreadypaid = $objp->paid;
569 $documentstatic->totalpaid = $objp->paid;
571 if (is_object($documentstaticline)) {
572 $documentstaticline->statut = $objp->status;
573 $documentstaticline->status = $objp->status;
576 print
'<tr class="oddeven">';
577 print
'<td class="nobordernopadding nowraponall">';
578 print $documentstatic->getNomUrl(1);
580 print
'<td class="center" width="80">'.dol_print_date(
$db->jdate($objp->dateprint),
'day').
'</td>';
582 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
583 print
'<td class="center">'.dol_print_date(
$db->jdate($objp->delivery_planned_date),
'day').
'</td>';
587 print
'<td class="center">';
588 if ($type_element ==
'contract') {
589 print $documentstaticline->getLibStatut(5);
590 } elseif ($documentstatic ==
null) {
592 } elseif ($type_element ==
'invoice') {
594 print $documentstatic->getLibStatut(5, $objp->paid);
595 } elseif ($type_element ==
'supplier_invoice') {
597 print $documentstatic->getLibStatut(5, $objp->paid);
599 print $documentstatic->getLibStatut(5);
604 print
'<td class="tdoverflowmax300">';
612 if ($objp->fk_product > 0) {
615 $product_static->type = $objp->fk_product_type;
616 $product_static->id = $objp->fk_product;
617 $product_static->ref = $objp->ref;
618 $product_static->entity = $objp->pentity;
619 $text = $product_static->getNomUrl(1);
623 if ($objp->fk_product > 0) {
627 $prod->fetch($objp->fk_product);
629 $outputlangs = $langs;
631 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
632 $newlang =
GETPOST(
'lang_id',
'aZ09');
634 if (empty($newlang)) {
635 $newlang =
$object->default_lang;
637 if (!empty($newlang)) {
639 $outputlangs->setDefaultLang($newlang);
642 $label = (!empty(
$prod->multilangs[$outputlangs->defaultlang][
"label"])) ?
$prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
644 $label = $objp->product_label;
647 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
651 if (($objp->info_bits & 2) == 2) { ?>
652 <a href=
"<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$object->id; ?>">
655 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
656 if ($objp->description ==
'(DEPOSIT)') {
657 $txt = $langs->trans(
"Deposit");
658 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
659 $txt = $langs->trans(
"ExcessReceived");
660 } elseif ($objp->description ==
'(EXCESS PAID)') {
661 $txt = $langs->trans(
"ExcessPaid");
668 if ($objp->description) {
669 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
670 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
672 $discount->fetch($objp->fk_remise_except);
673 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
675 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
677 $discount->fetch($objp->fk_remise_except);
678 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
679 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
681 $discount->fetch($objp->fk_remise_except);
682 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
683 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
685 $discount->fetch($objp->fk_remise_except);
686 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
689 echo
' ('.dol_print_date($discount->datec).
')';
696 if ($objp->fk_product > 0) {
697 echo $form->textwithtooltip($text, $description, 3, 0,
'', (
string) $i, 0,
'');
704 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
707 if (!empty($objp->label) || !empty($objp->description)) {
709 $text =
img_object($langs->trans(
'Service'),
'service');
711 $text =
img_object($langs->trans(
'Product'),
'product');
714 if (!empty($objp->label)) {
715 $text .=
' <strong>'.$objp->label.
'</strong>';
716 echo $form->textwithtooltip($text,
dol_htmlentitiesbr($objp->description), 3, 0,
'', (
string) $i, 0,
'');
749 $objp->prod_qty = -($objp->prod_qty);
751 print
'<td class="right"><span class="amount">'.$objp->prod_qty.
'</span></td>';
752 $total_qty += $objp->prod_qty;
754 print
'<td class="right"><span class="amount">'.price($objp->total_ht).
'</span></td>';
756 $total_ht += (float) $objp->total_ht;
758 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
759 $parameters = array(
'obj' => $objp);
760 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
761 print $hookmanager->resPrint;
766 print
'<tr class="liste_total">';
767 print
'<td>'.$langs->trans(
'Total').
'</td>';
768 print
'<td colspan="3"></td>';
770 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
773 print
'<td class="right">'.$total_qty.
'</td>';
774 print
'<td class="right">'.price($total_ht).
'</td>';
775 print
'<td class="right">'.price(
price2num($total_ht / (empty($total_qty) ? 1 : $total_qty),
'MU')).
'</td>';
776 $parameters = array();
777 $reshook = $hookmanager->executeHooks(
'printFieldListTotal', $parameters, $object, $action);
778 print $hookmanager->resPrint;
783 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
786} elseif (empty($type_element) || $type_element == -1) {
787 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'', 0,
'',
'nogreyscale', $limit);
789 print
'<table class="liste centpercent noborder">'.
"\n";
791 print
'<tr class="liste_titre">';
792 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
793 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
794 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
796 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
799 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
803 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'', 0,
'',
'nogreyscale', $limit);
805 print
'<table class="liste centpercent">'.
"\n";
807 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.
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.
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.