31require
"../main.inc.php";
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
47$langs->loadLangs(array(
"companies",
"bills",
"orders",
"suppliers",
"propal",
"interventions",
"contracts",
"products"));
50$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
55 $socid = $user->socid;
59$hookmanager->initHooks(array(
'consumptionthirdparty',
'globalcard'));
69$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
70$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
72$optioncss =
GETPOST(
'optioncss',
'alpha');
74if (empty($page) || $page == -1) {
77$offset = $limit * $page;
84 $sortfield =
'dateprint';
89$sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
94if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
96 $sprod_fulldescr =
'';
102$thirdTypeSelect =
GETPOST(
"third_select_id",
'aZ09');
103$type_element =
GETPOST(
'type_element') ?
GETPOST(
'type_element') :
'';
109$parameters = array(
'id' => $socid);
110$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
121$form =
new Form($db);
123$productstatic =
new Product($db);
125$title = $langs->trans(
"Referers",
$object->name);
127 $title =
$object->name.
" - ".$title;
129$help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
138print
dol_get_fiche_head($head,
'consumption', $langs->trans(
"ThirdParty"), -1,
'company');
140$linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
142dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
144print
'<div class="fichecenter">';
146print
'<div class="underbanner clearboth"></div>';
147print
'<table class="border centpercent tableforfield">';
150print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
155 print
'<tr><td class="titlefield">'.$langs->trans(
'Prefix').
'</td><td colspan="3">'.
$object->prefix_comm.
'</td></tr>';
159$elementTypeArray = array();
162 print
'<tr><td class="titlefield">';
163 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
165 $tmpcheck =
$object->check_codeclient();
166 if ($tmpcheck != 0 && $tmpcheck != -5) {
167 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
170 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"facture where fk_soc = ".((int) $socid);
171 $resql = $db->query($sql);
176 $obj = $db->fetch_object($resql);
177 $nbFactsClient = $obj->nb;
178 $thirdTypeArray = array();
179 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
180 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
181 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
183 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
184 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
186 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
187 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
189 if (isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')) {
190 $elementTypeArray[
'shipment'] = $langs->transnoentitiesnoconv(
'Shipments');
192 if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
193 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
197if (isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'lire')) {
198 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
202 $langs->load(
"supplier_proposal");
203 print
'<tr><td class="titlefield">';
204 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
206 $tmpcheck =
$object->check_codefournisseur();
207 if ($tmpcheck != 0 && $tmpcheck != -5) {
208 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
211 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"commande_fournisseur where fk_soc = ".((int) $socid);
212 $resql = $db->query($sql);
217 $obj = $db->fetch_object($resql);
218 $nbCmdsFourn = $obj->nb;
219 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
220 if ((isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'facture',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
221 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
223 if ((isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'commande',
'lire') && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
224 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
226 if (isModEnabled(
'reception') && $user->hasRight(
'reception',
'lire')) {
227 $langs->load(
'receptions');
228 $elementTypeArray[
'reception'] = $langs->transnoentitiesnoconv(
'Receptions');
230 if (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
231 $elementTypeArray[
'supplier_proposal'] = $langs->transnoentitiesnoconv(
'SupplierProposals');
242print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.$socid.
'">';
243print
'<input type="hidden" name="token" value="'.newToken().
'">';
246$documentstaticline =
'';
257if ($type_element ==
'fichinter') {
258 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
260 $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, ';
261 $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, ';
262 $tables_from = MAIN_DB_PREFIX.
"fichinter as f LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as d ON d.fk_fichinter = f.rowid";
263 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
264 $where .=
" AND f.entity = ".$conf->entity;
265 $dateprint =
'f.datec';
266 $doc_number =
'f.ref';
268if ($type_element ==
'invoice') {
269 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
270 $documentstatic =
new Facture($db);
271 $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, ';
272 $tables_from = MAIN_DB_PREFIX.
"facture as f,".MAIN_DB_PREFIX.
"facturedet as d";
273 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
274 $where .=
" AND d.fk_facture = f.rowid";
275 $where .=
" AND f.entity IN (".getEntity(
'invoice').
")";
276 $dateprint =
'f.datef';
277 $doc_number =
'f.ref';
278 $thirdTypeSelect =
'customer';
280if ($type_element ==
'propal') {
281 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
282 $documentstatic =
new Propal($db);
283 $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,';
284 $tables_from = MAIN_DB_PREFIX.
"propal as c,".MAIN_DB_PREFIX.
"propaldet as d";
285 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
286 $where .=
" AND d.fk_propal = c.rowid";
287 $where .=
" AND c.entity = ".$conf->entity;
288 $dateprint =
'c.datep';
289 $doc_number =
'c.ref';
290 $thirdTypeSelect =
'customer';
292if ($type_element ==
'order') {
293 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
294 $langs->load(
'sendings');
295 $documentstatic =
new Commande($db);
296 $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,';
297 $tables_from = MAIN_DB_PREFIX.
"commande as c,".MAIN_DB_PREFIX.
"commandedet as d";
298 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
299 $where .=
" AND d.fk_commande = c.rowid";
300 $where .=
" AND c.entity = ".$conf->entity;
301 $dateprint =
'c.date_commande';
302 $doc_number =
'c.ref';
303 $thirdTypeSelect =
'customer';
305if ($type_element ==
'shipment') {
306 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
307 $langs->load(
'sendings');
309 $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,';
310 $tables_from = MAIN_DB_PREFIX.
"expedition as e,".MAIN_DB_PREFIX.
"expeditiondet as ed,".MAIN_DB_PREFIX.
"commandedet as d";
311 $where =
" WHERE e.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
312 $where .=
" AND ed.fk_expedition = e.rowid";
313 $where .=
" AND ed.element_type = 'commande' AND ed.fk_elementdet = d.rowid";
314 $where .=
" AND e.entity = ".$conf->entity;
315 $dateprint =
'e.date_creation';
316 $doc_number =
'e.ref';
317 $thirdTypeSelect =
'customer';
319if ($type_element ==
'supplier_invoice') {
320 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
322 $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, ';
323 $tables_from = MAIN_DB_PREFIX.
"facture_fourn as f,".MAIN_DB_PREFIX.
"facture_fourn_det as d";
324 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
325 $where .=
" AND d.fk_facture_fourn = f.rowid";
326 $where .=
" AND f.entity = ".$conf->entity;
327 $dateprint =
'f.datef';
328 $doc_number =
'f.ref';
329 $thirdTypeSelect =
'supplier';
331if ($type_element ==
'supplier_proposal') {
332 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
334 $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, ';
335 $tables_from = MAIN_DB_PREFIX.
"supplier_proposal as c,".MAIN_DB_PREFIX.
"supplier_proposaldet as d";
336 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
337 $where .=
" AND d.fk_supplier_proposal = c.rowid";
338 $where .=
" AND c.entity = ".$conf->entity;
339 $dateprint =
'c.date_valid';
340 $doc_number =
'c.ref';
341 $thirdTypeSelect =
'supplier';
343if ($type_element ==
'supplier_order') {
344 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
345 $langs->load(
'sendings');
347 $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, ';
348 $tables_from = MAIN_DB_PREFIX.
"commande_fournisseur as c,".MAIN_DB_PREFIX.
"commande_fournisseurdet as d";
349 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
350 $where .=
" AND d.fk_commande = c.rowid";
351 $where .=
" AND c.entity = ".$conf->entity;
352 $dateprint =
'c.date_valid';
353 $doc_number =
'c.ref';
354 $thirdTypeSelect =
'supplier';
356if ($type_element ==
'reception') {
357 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
358 $langs->loadLangs([
'sendings',
'receptions']);
360 $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, ';
361 $tables_from = MAIN_DB_PREFIX.
"reception as r,".MAIN_DB_PREFIX.
"receptiondet_batch as rd,".MAIN_DB_PREFIX.
"commande_fournisseurdet as d";
362 $where =
" WHERE r.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
363 $where .=
" AND rd.fk_reception = r.rowid";
364 $where .=
" AND rd.fk_elementdet = d.rowid AND rd.element_type = 'supplier_order'";
365 $where .=
" AND r.entity = ".$conf->entity;
366 $dateprint =
'r.date_creation';
367 $doc_number =
'r.ref';
368 $thirdTypeSelect =
'supplier';
370if ($type_element ==
'contract') {
371 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
372 $documentstatic =
new Contrat($db);
374 $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,';
375 $tables_from = MAIN_DB_PREFIX.
"contrat as c,".MAIN_DB_PREFIX.
"contratdet as d";
376 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
377 $where .=
" AND d.fk_contrat = c.rowid";
378 $where .=
" AND c.entity = ".$conf->entity;
379 $dateprint =
'c.date_valid';
380 $doc_number =
'c.ref';
381 $thirdTypeSelect =
'customer';
384$parameters = array();
385$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
387if (!empty($sql_select)) {
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 ';
419 $sql .=
" AND ".$doc_number.
" LIKE '%".$db->escape($sref).
"%'";
421 if ($sprod_fulldescr) {
423 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%' OR d.description LIKE '%".$db->escape(
dol_escape_htmltag($sprod_fulldescr)).
"%'";
424 if (
GETPOST(
'type_element') !=
'fichinter') {
425 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
427 if (
GETPOST(
'type_element') !=
'fichinter') {
428 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
432 $sql .= $db->order($sortfield, $sortorder);
434 $resql = $db->query($sql);
435 $totalnboflines = $db->num_rows($resql);
437 $sql .= $db->plimit($limit + 1, $offset);
443if (empty($elementTypeArray) && !
$object->client && !
$object->fournisseur) {
444 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
449$typeElementString = $form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
450$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")).
'">';
458 $resql = $db->query($sql);
463 $num = $db->num_rows($resql);
465 $param =
"&socid=".urlencode((
string) ($socid)).
"&type_element=".urlencode((
string) ($type_element));
466 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
467 $param .=
'&contextpage='.urlencode($contextpage);
469 if ($limit > 0 && $limit !=
$conf->liste_limit) {
470 $param .=
'&limit='.((int) $limit);
472 if ($sprod_fulldescr) {
473 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
476 $param .=
"&sref=".urlencode($sref);
479 $param .=
"&month=".urlencode((
string) ($month));
482 $param .=
"&year=".urlencode((
string) ($year));
485 $param .=
'&optioncss='.urlencode($optioncss);
488 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'', $limit);
490 print
'<div class="div-table-responsive-no-min">';
491 print
'<table class="liste centpercent noborder">'.
"\n";
494 print
'<tr class="liste_titre">';
495 print
'<th class="liste_titre">';
496 print
'<input class="flat" type="text" name="sref" size="8" value="'.$sref.
'">';
498 print
'<th class="liste_titre nowrap center valignmiddle">';
499 print $formother->select_month($month ? $month : -1,
'month', 1, 0,
'valignmiddle');
500 print $formother->selectyear($year ? $year : -1,
'year', 1, 20, 1, 0, 0,
'',
'valignmiddle maxwidth75imp marginleftonly');
503 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
504 print
'<td class="liste_titre center"></td>';
506 print
'<th class="liste_titre center">';
508 print
'<th class="liste_titre left">';
509 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
511 print
'<th class="liste_titre center">';
513 print
'<th class="liste_titre center">';
515 print
'<th class="liste_titre maxwidthsearch">';
516 $searchpicto = $form->showFilterAndCheckAddButtons(0);
522 print
'<tr class="liste_titre">';
523 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
524 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'', $sortfield, $sortorder,
'center ');
526 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
527 print_liste_field_titre(
'DateDeliveryPlanned', $_SERVER[
'PHP_SELF'],
'delivery_planned_date',
'', $param,
'', $sortfield, $sortorder,
'center ');
529 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
531 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
532 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
533 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
537 while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) {
538 $documentstatic->id = $objp->doc_id;
539 $documentstatic->ref = $objp->doc_number;
540 $documentstatic->type = $objp->doc_type;
541 $documentstatic->fk_statut = $objp->status;
542 $documentstatic->fk_status = $objp->status;
543 $documentstatic->statut = $objp->status;
544 $documentstatic->status = $objp->status;
545 $documentstatic->paye = $objp->paid;
546 $documentstatic->alreadypaid = $objp->paid;
547 $documentstatic->totalpaid = $objp->paid;
549 if (is_object($documentstaticline)) {
550 $documentstaticline->statut = $objp->status;
551 $documentstaticline->status = $objp->status;
554 print
'<tr class="oddeven">';
555 print
'<td class="nobordernopadding nowrap" width="100">';
556 print $documentstatic->getNomUrl(1);
558 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
560 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
561 print
'<td class="center">'.dol_print_date($db->jdate($objp->delivery_planned_date),
'day').
'</td>';
565 print
'<td class="center">';
566 if ($type_element ==
'contract') {
567 print $documentstaticline->getLibStatut(5);
568 } elseif ($type_element ==
'invoice') {
570 print $documentstatic->getLibStatut(5, $objp->paid);
571 } elseif ($type_element ==
'supplier_invoice') {
573 print $documentstatic->getLibStatut(5, $objp->paid);
575 print $documentstatic->getLibStatut(5);
580 print
'<td class="tdoverflowmax300">';
588 if ($objp->fk_product > 0) {
589 $product_static =
new Product($db);
591 $product_static->type = $objp->fk_product_type;
592 $product_static->id = $objp->fk_product;
593 $product_static->ref = $objp->ref;
594 $product_static->entity = $objp->pentity;
595 $text = $product_static->getNomUrl(1);
599 if ($objp->fk_product > 0) {
603 $prod->fetch($objp->fk_product);
605 $outputlangs = $langs;
607 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
608 $newlang =
GETPOST(
'lang_id',
'aZ09');
610 if (empty($newlang)) {
611 $newlang =
$object->default_lang;
613 if (!empty($newlang)) {
615 $outputlangs->setDefaultLang($newlang);
618 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
620 $label = $objp->product_label;
623 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
627 if (($objp->info_bits & 2) == 2) { ?>
628 <a href=
"<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$object->id; ?>">
631 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
632 if ($objp->description ==
'(DEPOSIT)') {
633 $txt = $langs->trans(
"Deposit");
634 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
635 $txt = $langs->trans(
"ExcessReceived");
636 } elseif ($objp->description ==
'(EXCESS PAID)') {
637 $txt = $langs->trans(
"ExcessPaid");
644 if ($objp->description) {
645 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
646 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
648 $discount->fetch($objp->fk_remise_except);
649 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
651 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
653 $discount->fetch($objp->fk_remise_except);
654 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
655 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
657 $discount->fetch($objp->fk_remise_except);
658 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
659 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
661 $discount->fetch($objp->fk_remise_except);
662 echo($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
665 echo
' ('.dol_print_date($discount->datec).
')';
672 if ($objp->fk_product > 0) {
673 echo $form->textwithtooltip($text, $description, 3,
'',
'', $i, 0,
'');
680 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
683 if (!empty($objp->label) || !empty($objp->description)) {
685 $text =
img_object($langs->trans(
'Service'),
'service');
687 $text =
img_object($langs->trans(
'Product'),
'product');
690 if (!empty($objp->label)) {
691 $text .=
' <strong>'.$objp->label.
'</strong>';
692 echo $form->textwithtooltip($text,
dol_htmlentitiesbr($objp->description), 3,
'',
'', $i, 0,
'');
725 $objp->prod_qty = -($objp->prod_qty);
727 print
'<td class="right"><span class="amount">'.$objp->prod_qty.
'</span></td>';
728 $total_qty += $objp->prod_qty;
730 print
'<td class="right"><span class="amount">'.price($objp->total_ht).
'</span></td>';
732 $total_ht += (float) $objp->total_ht;
734 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
740 print
'<tr class="liste_total">';
741 print
'<td>'.$langs->trans(
'Total').
'</td>';
742 print
'<td colspan="3"></td>';
744 if ($type_element ==
'order' || $type_element ==
'supplier_order' || $type_element ==
'shipment') {
747 print
'<td class="right">'.$total_qty.
'</td>';
748 print
'<td class="right">'.price($total_ht).
'</td>';
749 print
'<td class="right">'.price(
price2num($total_ht / (empty($total_qty) ? 1 : $total_qty),
'MU')).
'</td>';
754 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
757} elseif (empty($type_element) || $type_element == -1) {
758 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', (!empty($num) ? $num : 0),
'',
'');
760 print
'<table class="liste centpercent noborder">'.
"\n";
762 print
'<tr class="liste_titre">';
763 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
764 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
765 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
767 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
770 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
774 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
776 print
'<table class="liste centpercent">'.
"\n";
778 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"FeatureNotYetAvailable").
'</span></td></tr>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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)
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.