30 require
"../main.inc.php";
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
38 $langs->loadLangs(array(
"companies",
"bills",
"orders",
"suppliers",
"propal",
"interventions",
"contracts",
"products"));
41 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'thirdpartylist';
44 $socid =
GETPOST(
'socid',
'int');
46 $socid = $user->socid;
51 $object->fetch($socid);
55 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
56 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
57 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
59 $optioncss =
GETPOST(
'optioncss',
'alpha');
61 if (empty($page) || $page == -1) {
64 $offset = $limit * $page;
65 $pageprev = $page - 1;
66 $pagenext = $page + 1;
71 $sortfield =
'dateprint';
76 $sprod_fulldescr =
GETPOST(
"sprod_fulldescr");
77 $month =
GETPOST(
'month',
'int');
81 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
83 $sprod_fulldescr =
'';
89 $thirdTypeSelect =
GETPOST(
"third_select_id",
'az09');
90 $type_element =
GETPOST(
'type_element') ?
GETPOST(
'type_element') :
'';
94 $hookmanager->initHooks(array(
'consumptionthirdparty',
'globalcard'));
101 $parameters = array(
'id'=>$socid);
102 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
115 $productstatic =
new Product($db);
117 $title = $langs->trans(
"Referers", $object->name);
118 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
119 $title = $object->name.
" - ".$title;
121 $help_url =
'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
130 print
dol_get_fiche_head($head,
'consumption', $langs->trans(
"ThirdParty"), -1,
'company');
132 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
134 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
136 print
'<div class="fichecenter">';
138 print
'<div class="underbanner clearboth"></div>';
139 print
'<table class="border centpercent tableforfield">';
142 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
143 print $object->getTypeUrl(1);
146 if (!empty($conf->global->SOCIETE_USEPREFIX)) {
147 print
'<tr><td class="titlefield">'.$langs->trans(
'Prefix').
'</td><td colspan="3">'.$object->prefix_comm.
'</td></tr>';
152 if ($object->client) {
153 print
'<tr><td class="titlefield">';
154 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
156 $tmpcheck = $object->check_codeclient();
157 if ($tmpcheck != 0 && $tmpcheck != -5) {
158 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
161 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"facture where fk_soc = ".((int) $socid);
162 $resql = $db->query($sql);
167 $obj = $db->fetch_object(
$resql);
168 $nbFactsClient = $obj->nb;
169 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
170 if (
isModEnabled(
"propal") && $user->rights->propal->lire) {
171 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
173 if (
isModEnabled(
'commande') && $user->rights->commande->lire) {
174 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
176 if (
isModEnabled(
'facture') && $user->rights->facture->lire) {
177 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
179 if (
isModEnabled(
'contrat') && $user->rights->contrat->lire) {
180 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
184 if (
isModEnabled(
'ficheinter') && !empty($user->rights->ficheinter->lire)) {
185 $elementTypeArray[
'fichinter'] = $langs->transnoentitiesnoconv(
'Interventions');
188 if ($object->fournisseur) {
189 $langs->load(
"supplier_proposal");
190 print
'<tr><td class="titlefield">';
191 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
193 $tmpcheck = $object->check_codefournisseur();
194 if ($tmpcheck != 0 && $tmpcheck != -5) {
195 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
198 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"commande_fournisseur where fk_soc = ".((int) $socid);
199 $resql = $db->query($sql);
204 $obj = $db->fetch_object(
$resql);
205 $nbCmdsFourn = $obj->nb;
206 $thirdTypeArray[
'supplier'] = $langs->trans(
"supplier");
207 if ((
isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'facture',
'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (
isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
208 $elementTypeArray[
'supplier_invoice'] = $langs->transnoentitiesnoconv(
'SuppliersInvoices');
210 if ((
isModEnabled(
'fournisseur') && $user->hasRight(
'fournisseur',
'commande',
'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (
isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
211 $elementTypeArray[
'supplier_order'] = $langs->transnoentitiesnoconv(
'SuppliersOrders');
213 if (
isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
214 $elementTypeArray[
'supplier_proposal'] = $langs->transnoentitiesnoconv(
'SupplierProposals');
225 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'?socid='.$socid.
'">';
226 print
'<input type="hidden" name="token" value="'.newToken().
'">';
229 $documentstaticline =
'';
240 if ($type_element ==
'fichinter') {
241 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
243 $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, ';
244 $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, ';
245 $tables_from = MAIN_DB_PREFIX.
"fichinter as f LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as d ON d.fk_fichinter = f.rowid";
246 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
247 $where .=
" AND f.entity = ".$conf->entity;
248 $dateprint =
'f.datec';
249 $doc_number =
'f.ref';
251 if ($type_element ==
'invoice') {
252 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
253 $documentstatic =
new Facture($db);
254 $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, ';
255 $tables_from = MAIN_DB_PREFIX.
"facture as f,".MAIN_DB_PREFIX.
"facturedet as d";
256 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
257 $where .=
" AND d.fk_facture = f.rowid";
258 $where .=
" AND f.entity IN (".getEntity(
'invoice').
")";
259 $dateprint =
'f.datef';
260 $doc_number =
'f.ref';
261 $thirdTypeSelect =
'customer';
263 if ($type_element ==
'propal') {
264 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
265 $documentstatic =
new Propal($db);
266 $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,';
267 $tables_from = MAIN_DB_PREFIX.
"propal as c,".MAIN_DB_PREFIX.
"propaldet as d";
268 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
269 $where .=
" AND d.fk_propal = c.rowid";
270 $where .=
" AND c.entity = ".$conf->entity;
271 $dateprint =
'c.datep';
272 $doc_number =
'c.ref';
273 $thirdTypeSelect =
'customer';
275 if ($type_element ==
'order') {
276 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
277 $langs->load(
'sendings');
278 $documentstatic =
new Commande($db);
279 $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,';
280 $tables_from = MAIN_DB_PREFIX.
"commande as c,".MAIN_DB_PREFIX.
"commandedet as d";
281 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
282 $where .=
" AND d.fk_commande = c.rowid";
283 $where .=
" AND c.entity = ".$conf->entity;
284 $dateprint =
'c.date_commande';
285 $doc_number =
'c.ref';
286 $thirdTypeSelect =
'customer';
288 if ($type_element ==
'supplier_invoice') {
289 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
291 $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, ';
292 $tables_from = MAIN_DB_PREFIX.
"facture_fourn as f,".MAIN_DB_PREFIX.
"facture_fourn_det as d";
293 $where =
" WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
294 $where .=
" AND d.fk_facture_fourn = f.rowid";
295 $where .=
" AND f.entity = ".$conf->entity;
296 $dateprint =
'f.datef';
297 $doc_number =
'f.ref';
298 $thirdTypeSelect =
'supplier';
300 if ($type_element ==
'supplier_proposal') {
301 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
303 $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, ';
304 $tables_from = MAIN_DB_PREFIX.
"supplier_proposal as c,".MAIN_DB_PREFIX.
"supplier_proposaldet as d";
305 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
306 $where .=
" AND d.fk_supplier_proposal = c.rowid";
307 $where .=
" AND c.entity = ".$conf->entity;
308 $dateprint =
'c.date_valid';
309 $doc_number =
'c.ref';
310 $thirdTypeSelect =
'supplier';
312 if ($type_element ==
'supplier_order') {
313 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
314 $langs->load(
'sendings');
316 $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, ';
317 $tables_from = MAIN_DB_PREFIX.
"commande_fournisseur as c,".MAIN_DB_PREFIX.
"commande_fournisseurdet as d";
318 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
319 $where .=
" AND d.fk_commande = c.rowid";
320 $where .=
" AND c.entity = ".$conf->entity;
321 $dateprint =
'c.date_valid';
322 $doc_number =
'c.ref';
323 $thirdTypeSelect =
'supplier';
325 if ($type_element ==
'contract') {
326 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
327 $documentstatic =
new Contrat($db);
329 $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,';
330 $tables_from = MAIN_DB_PREFIX.
"contrat as c,".MAIN_DB_PREFIX.
"contratdet as d";
331 $where =
" WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
332 $where .=
" AND d.fk_contrat = c.rowid";
333 $where .=
" AND c.entity = ".$conf->entity;
334 $dateprint =
'c.date_valid';
335 $doc_number =
'c.ref';
336 $thirdTypeSelect =
'customer';
339 $parameters = array();
340 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
342 if (!empty($sql_select)) {
344 $sql .=
' d.description as description,';
345 if ($type_element !=
'fichinter' && $type_element !=
'contract' && $type_element !=
'supplier_proposal') {
346 $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, ';
348 if ($type_element ==
'supplier_proposal') {
349 $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, ';
351 if ($type_element ==
'contract') {
352 $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, ';
354 if ($type_element !=
'fichinter') {
355 $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, ';
357 $sql .=
" s.rowid as socid ";
358 if ($type_element !=
'fichinter') {
359 $sql .=
", p.ref as prod_ref, p.label as product_label";
361 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".$tables_from;
362 if ($type_element !=
'fichinter') {
363 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as p ON d.fk_product = p.rowid ';
368 $sql .=
" AND ".$doc_number.
" LIKE '%".$db->escape($sref).
"%'";
370 if ($sprod_fulldescr) {
372 $sql .=
" AND (d.description LIKE '%".$db->escape($sprod_fulldescr).
"%' OR d.description LIKE '%".$db->escape(
dol_escape_htmltag($sprod_fulldescr)).
"%'";
373 if (
GETPOST(
'type_element') !=
'fichinter') {
374 $sql .=
" OR p.ref LIKE '%".$db->escape($sprod_fulldescr).
"%'";
376 if (
GETPOST(
'type_element') !=
'fichinter') {
377 $sql .=
" OR p.label LIKE '%".$db->escape($sprod_fulldescr).
"%'";
381 $sql .= $db->order($sortfield, $sortorder);
383 $resql = $db->query($sql);
384 $totalnboflines = $db->num_rows(
$resql);
386 $sql .= $db->plimit($limit + 1, $offset);
392 if (empty($elementTypeArray) && !$object->client && !$object->fournisseur) {
393 $showempty = $langs->trans(
"ThirdpartyNotCustomerNotSupplierSoNoRef");
398 $typeElementString =
$form->selectarray(
"type_element", $elementTypeArray,
GETPOST(
'type_element'), $showempty, 0, 0,
'', 0, 0, $disabled,
'',
'maxwidth150onsmartphone');
399 $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")).
'">';
405 $resql = $db->query($sql);
410 $num = $db->num_rows(
$resql);
412 $param =
"&socid=".urlencode($socid).
"&type_element=".urlencode($type_element);
413 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
414 $param .=
'&contextpage='.urlencode($contextpage);
416 if ($limit > 0 && $limit != $conf->liste_limit) {
417 $param .=
'&limit='.urlencode($limit);
419 if ($sprod_fulldescr) {
420 $param .=
"&sprod_fulldescr=".urlencode($sprod_fulldescr);
423 $param .=
"&sref=".urlencode($sref);
426 $param .=
"&month=".urlencode($month);
429 $param .=
"&year=".urlencode($year);
432 $param .=
'&optioncss='.urlencode($optioncss);
435 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $totalnboflines,
'', 0,
'',
'', $limit);
437 print
'<div class="div-table-responsive-no-min">';
438 print
'<table class="liste centpercent">'.
"\n";
441 print
'<tr class="liste_titre">';
442 print
'<td class="liste_titre left">';
443 print
'<input class="flat" type="text" name="sref" size="8" value="'.$sref.
'">';
445 print
'<td class="liste_titre nowrap center valignmiddle">';
446 print $formother->select_month($month ? $month : -1,
'month', 1, 0,
'valignmiddle');
447 print $formother->selectyear($year ? $year : -1,
'year', 1, 20, 1, 0, 0,
'',
'valignmiddle maxwidth75imp marginleftonly');
450 if ($type_element ==
'order' || $type_element ==
'supplier_order') {
451 print
'<td class="liste_titre center"></td>';
453 print
'<td class="liste_titre center">';
455 print
'<td class="liste_titre left">';
456 print
'<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).
'">';
458 print
'<td class="liste_titre center">';
460 print
'<td class="liste_titre center">';
462 print
'<td class="liste_titre maxwidthsearch">';
463 $searchpicto =
$form->showFilterAndCheckAddButtons(0);
469 print
'<tr class="liste_titre">';
470 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
471 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'', $sortfield, $sortorder,
'center ');
473 if ($type_element ==
'order' || $type_element ==
'supplier_order') {
474 print_liste_field_titre(
'DateDeliveryPlanned', $_SERVER[
'PHP_SELF'],
'delivery_planned_date',
'', $param,
'', $sortfield, $sortorder,
'center ');
476 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_statut',
'', $param,
'', $sortfield, $sortorder,
'center ');
478 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
479 print_liste_field_titre(
'TotalHT', $_SERVER[
'PHP_SELF'],
'total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
480 print_liste_field_titre(
'UnitPrice', $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
485 while (($objp = $db->fetch_object(
$resql)) && $i < min($num, $limit)) {
486 $documentstatic->id = $objp->doc_id;
487 $documentstatic->ref = $objp->doc_number;
488 $documentstatic->type = $objp->doc_type;
489 $documentstatic->fk_statut = $objp->status;
490 $documentstatic->fk_status = $objp->status;
491 $documentstatic->statut = $objp->status;
492 $documentstatic->status = $objp->status;
493 $documentstatic->paye = $objp->paid;
494 $documentstatic->alreadypaid = $objp->paid;
496 if (is_object($documentstaticline)) {
497 $documentstaticline->statut = $objp->status;
500 print
'<tr class="oddeven">';
501 print
'<td class="nobordernopadding nowrap" width="100">';
502 print $documentstatic->getNomUrl(1);
504 print
'<td class="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),
'day').
'</td>';
506 if ($type_element ==
'order' || $type_element ==
'supplier_order') {
507 print
'<td class="center">'.dol_print_date($db->jdate($objp->delivery_planned_date),
'day').
'</td>';
511 print
'<td class="center">';
512 if ($type_element ==
'contract') {
513 print $documentstaticline->getLibStatut(5);
514 } elseif ($type_element ==
'invoice') {
515 print $documentstatic->getLibStatut(5, $objp->paid);
516 } elseif ($type_element ==
'supplier_invoice') {
517 print $documentstatic->getLibStatut(5, $objp->paid);
519 print $documentstatic->getLibStatut(5);
524 print
'<td class="tdoverflowmax300">';
532 if ($objp->fk_product > 0) {
533 $product_static =
new Product($db);
535 $product_static->type = $objp->fk_product_type;
536 $product_static->id = $objp->fk_product;
537 $product_static->ref = $objp->ref;
538 $product_static->entity = $objp->pentity;
539 $text = $product_static->getNomUrl(1);
543 if ($objp->fk_product > 0) {
545 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
547 $prod->fetch($objp->fk_product);
549 $outputlangs = $langs;
551 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
552 $newlang =
GETPOST(
'lang_id',
'aZ09');
554 if (empty($newlang)) {
555 $newlang = $object->default_lang;
557 if (!empty($newlang)) {
559 $outputlangs->setDefaultLang($newlang);
562 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
564 $label = $objp->product_label;
567 $text .=
' - '.(!empty($objp->label) ? $objp->label : $label);
571 if (($objp->info_bits & 2) == 2) { ?>
572 <a href=
"<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$object->id; ?>">
575 print
img_object($langs->trans(
"ShowReduc"),
'reduc').
' ';
576 if ($objp->description ==
'(DEPOSIT)') {
577 $txt = $langs->trans(
"Deposit");
578 } elseif ($objp->description ==
'(EXCESS RECEIVED)') {
579 $txt = $langs->trans(
"ExcessReceived");
580 } elseif ($objp->description ==
'(EXCESS PAID)') {
581 $txt = $langs->trans(
"ExcessPaid");
588 if ($objp->description) {
589 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
590 if ($objp->description ==
'(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
592 $discount->fetch($objp->fk_remise_except);
593 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromCreditNote", $discount->getNomUrl(0));
595 if ($objp->description ==
'(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
597 $discount->fetch($objp->fk_remise_except);
598 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessReceived", $discount->getNomUrl(0));
599 } elseif ($objp->description ==
'(EXCESS PAID)' && $objp->fk_remise_except > 0) {
601 $discount->fetch($objp->fk_remise_except);
602 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromExcessPaid", $discount->getNomUrl(0));
603 } elseif ($objp->description ==
'(DEPOSIT)' && $objp->fk_remise_except > 0) {
605 $discount->fetch($objp->fk_remise_except);
606 echo ($txt ?
' - ' :
'').$langs->transnoentities(
"DiscountFromDeposit", $discount->getNomUrl(0));
608 if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
609 echo
' ('.dol_print_date($discount->datec).
')';
612 echo ($txt ?
' - ' :
'').dol_htmlentitiesbr($objp->description);
616 if ($objp->fk_product > 0) {
617 echo
$form->textwithtooltip($text, $description, 3,
'',
'', $i, 0,
'');
624 print (!empty($objp->description) && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
627 if (!empty($objp->label) || !empty($objp->description)) {
629 $text =
img_object($langs->trans(
'Service'),
'service');
631 $text =
img_object($langs->trans(
'Product'),
'product');
634 if (!empty($objp->label)) {
635 $text .=
' <strong>'.$objp->label.
'</strong>';
669 $objp->prod_qty = -($objp->prod_qty);
671 print
'<td class="right"><span class="amount">'.$objp->prod_qty.
'</span></td>';
672 $total_qty += $objp->prod_qty;
674 print
'<td class="right"><span class="amount">'.price($objp->total_ht).
'</span></td>';
675 if (empty($total_ht)) {
678 $total_ht += (
float) $objp->total_ht;
680 print
'<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).
'</td>';
686 print
'<tr class="liste_total">';
687 print
'<td>'.$langs->trans(
'Total').
'</td>';
688 print
'<td colspan="3"></td>';
690 if ($type_element ==
'order' || $type_element ==
'supplier_order') {
693 print
'<td class="right">'.$total_qty.
'</td>';
694 print
'<td class="right">'.price($total_ht).
'</td>';
695 print
'<td class="right">'.price(
price2num($total_ht / (empty($total_qty) ? 1 : $total_qty),
'MU')).
'</td>';
700 print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
703 } elseif (empty($type_element) || $type_element == -1) {
704 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', (!empty($num) ? $num : 0),
'',
'');
706 print
'<table class="liste centpercent">'.
"\n";
708 print
'<tr class="liste_titre">';
709 print_liste_field_titre(
'Ref', $_SERVER[
'PHP_SELF'],
'doc_number',
'', $param,
'', $sortfield, $sortorder,
'left ');
710 print_liste_field_titre(
'Date', $_SERVER[
'PHP_SELF'],
'dateprint',
'', $param,
'width="150"', $sortfield, $sortorder,
'center ');
711 print_liste_field_titre(
'Status', $_SERVER[
'PHP_SELF'],
'fk_status',
'', $param,
'', $sortfield, $sortorder,
'center ');
713 print_liste_field_titre(
'Quantity', $_SERVER[
'PHP_SELF'],
'prod_qty',
'', $param,
'', $sortfield, $sortorder,
'right ');
716 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"SelectElementAndClick", $langs->transnoentitiesnoconv(
"Search")).
'</span></td></tr>';
720 print_barre_liste($langs->trans(
'ProductsIntoElements').
' '.$typeElementString.
' '.$button, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
'',
'');
722 print
'<table class="liste centpercent">'.
"\n";
724 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"FeatureNotYetAvailable").
'</span></td></tr>';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage predefined suppliers products.
Class to manage customers orders.
Class to manage contracts.
Class to manage lines of contracts.
Class to manage absolute discounts.
Class to manage suppliers invoices.
Class to manage invoices.
const TYPE_CREDIT_NOTE
Credit note invoice.
Class to manage interventions.
Class to manage products or services.
Class to manage proposals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage price ask supplier.
Class to manage translations.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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).
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
get_date_range($date_start, $date_end, $format='', $outputlangs='', $withparenthesis=1)
Format output for start and end date.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
isModEnabled($module)
Is Dolibarr module enabled.
div float
Buy price without taxes.
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.