27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
37 $langs->loadLangs(array(
"sendings",
"receptions",
"deliveries",
'companies',
'bills',
'orders'));
39 $socid =
GETPOST(
'socid',
'int');
40 $massaction =
GETPOST(
'massaction',
'alpha');
41 $toselect =
GETPOST(
'toselect',
'array');
44 $receptionid =
GETPOST(
'id',
'int');
45 if ($user->socid) $socid = $user->socid;
48 $diroutputmassaction = $conf->reception->dir_output.
'/temp/massgeneration/'.$user->id;
50 $search_ref_rcp =
GETPOST(
"search_ref_rcp");
51 $search_ref_liv =
GETPOST(
'search_ref_liv');
52 $search_ref_supplier =
GETPOST(
'search_ref_supplier');
53 $search_company =
GETPOST(
"search_company");
54 $search_town =
GETPOST(
'search_town',
'alpha');
55 $search_zip =
GETPOST(
'search_zip',
'alpha');
56 $search_state =
GETPOST(
"search_state");
57 $search_country =
GETPOST(
"search_country",
'int');
58 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
59 $search_billed =
GETPOST(
"search_billed",
'int');
60 $sall =
GETPOST(
'sall',
'alphanohtml');
61 $optioncss =
GETPOST(
'optioncss',
'alpha');
63 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
64 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
65 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
67 if (!$sortfield) $sortfield =
"e.ref";
68 if (!$sortorder) $sortorder =
"DESC";
69 if (empty($page) || $page == -1) { $page = 0; }
70 $offset = $limit * $page;
71 $pageprev = $page - 1;
72 $pagenext = $page + 1;
75 $contextpage =
'receptionlist';
77 $search_status =
GETPOST(
'search_status');
82 $hookmanager->initHooks(array(
'receptionlist'));
86 $extrafields->fetch_name_optionals_label($object->table_element);
87 $search_array_options = (array) $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
90 $fieldstosearchall = array(
92 's.nom'=>
"ThirdParty",
93 'e.note_public'=>
'NotePublic',
95 if (empty($user->socid)) $fieldstosearchall[
"e.note_private"] =
"NotePrivate";
97 $checkedtypetiers = 0;
99 'e.ref'=>array(
'label'=>$langs->trans(
"Ref"),
'checked'=>1),
100 'e.ref_supplier'=>array(
'label'=>$langs->trans(
"RefSupplier"),
'checked'=>1),
101 's.nom'=>array(
'label'=>$langs->trans(
"ThirdParty"),
'checked'=>1),
102 's.town'=>array(
'label'=>$langs->trans(
"Town"),
'checked'=>1),
103 's.zip'=>array(
'label'=>$langs->trans(
"Zip"),
'checked'=>1),
104 'state.nom'=>array(
'label'=>$langs->trans(
"StateShort"),
'checked'=>0),
105 'country.code_iso'=>array(
'label'=>$langs->trans(
"Country"),
'checked'=>0),
106 'typent.code'=>array(
'label'=>$langs->trans(
"ThirdPartyType"),
'checked'=>$checkedtypetiers),
107 'e.date_delivery'=>array(
'label'=>$langs->trans(
"DateDeliveryPlanned"),
'checked'=>1),
108 'e.datec'=>array(
'label'=>$langs->trans(
"DateCreation"),
'checked'=>0,
'position'=>500),
109 'e.tms'=>array(
'label'=>$langs->trans(
"DateModificationShort"),
'checked'=>0,
'position'=>500),
110 'e.fk_statut'=>array(
'label'=>$langs->trans(
"Status"),
'checked'=>1,
'position'=>1000),
111 'e.billed'=>array(
'label'=>$langs->trans(
"Billed"),
'checked'=>1,
'position'=>1000,
'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)))
115 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
125 if (
GETPOST(
'cancel')) { $action =
'list'; $massaction =
''; }
126 if (!
GETPOST(
'confirmmassaction') && $massaction !=
'confirm_createbills') { $massaction =
''; }
128 $parameters = array(
'socid'=>$socid);
129 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
130 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
132 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
135 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
137 $search_ref_supplier =
'';
138 $search_ref_rcp =
'';
139 $search_ref_liv =
'';
140 $search_company =
'';
144 $search_country =
'';
145 $search_type_thirdparty =
'';
148 $search_array_options = array();
153 if ($massaction ==
'confirm_createbills') {
154 $receptions =
GETPOST(
'toselect',
'array');
155 $createbills_onebythird =
GETPOST(
'createbills_onebythird',
'int');
156 $validate_invoices =
GETPOST(
'validate_invoices',
'int');
159 $TFactThird = array();
161 $nb_bills_created = 0;
165 foreach ($receptions as $id_reception)
169 if ($rcp->fetch($id_reception) <= 0 || $rcp->statut != 1) {
170 $errors[] = $langs->trans(
'StatusOfRefMustBe', $rcp->ref, $langs->transnoentities(
"StatusSupplierOrderValidatedShort"));
176 if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) {
177 $object = $TFactThird[$rcp->socid];
178 if (empty($object->rowid) && $object->id != null)$object->rowid = $object->id;
179 if (!empty($object->rowid))$object->fetchObjectLinked();
180 $rcp->fetchObjectLinked();
182 if (count($rcp->linkedObjectsIds[
'reception']) > 0)
184 foreach ($rcp->linkedObjectsIds[
'reception'] as $key => $value)
186 if (empty($object->linkedObjectsIds[
'reception']) || !in_array($value, $object->linkedObjectsIds[
'reception']))
187 $object->add_object_linked(
'reception', $value);
191 $object->socid = $rcp->socid;
193 $object->cond_reglement_id = $rcp->thirdparty->cond_reglement_supplier_id;
194 $object->mode_reglement_id = $rcp->thirdparty->mode_reglement_supplier_id;
195 $object->fk_account = !empty($rcp->thirdparty->fk_account) ? $rcp->thirdparty->fk_account : 0;
196 $object->remise_percent = !empty($rcp->thirdparty->remise_percent) ? $rcp->thirdparty->remise_percent : 0;
197 $object->remise_absolue = !empty($rcp->thirdparty->remise_absolue) ? $rcp->thirdparty->remise_absolue : 0;
199 $object->fk_project = $rcp->fk_project;
200 $object->ref_supplier = $rcp->ref_supplier;
203 if (empty($datefacture))
205 $datefacture =
dol_mktime(date(
"h"), date(
"M"), 0, date(
"m"), date(
"d"), date(
"Y"));
208 $object->date = $datefacture;
209 $object->origin =
'reception';
210 $object->origin_id = $id_reception;
212 $rcp->fetchObjectLinked();
213 if (count($rcp->linkedObjectsIds[
'reception']) > 0)
215 foreach ($rcp->linkedObjectsIds[
'reception'] as $key => $value)
217 $object->linked_objects[
'reception'] = $value;
221 $res = $object->create($user);
227 $errors[] = $rcp->ref.
' : '.$langs->trans($object->error);
234 if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) {
235 $res = $object->add_object_linked($object->origin, $id_reception);
239 $errors[] = $object->error;
246 $lines = $rcp->lines;
247 if (empty($lines) && method_exists($rcp,
'fetch_lines'))
250 $lines = $rcp->lines;
254 $num = count($lines);
256 for ($i = 0; $i < $num; $i++)
258 $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
259 if ($lines[$i]->subprice < 0)
263 $discount->fk_soc = $object->socid;
264 $discount->amount_ht = abs($lines[$i]->total_ht);
265 $discount->amount_tva = abs($lines[$i]->total_tva);
266 $discount->amount_ttc = abs($lines[$i]->total_ttc);
267 $discount->tva_tx = $lines[$i]->tva_tx;
268 $discount->fk_user = $user->id;
269 $discount->description = $desc;
270 $discountid = $discount->create($user);
273 $result = $object->insert_discount($discountid);
282 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
285 if ($lines[$i]->date_debut_prevue) $date_start = $lines[$i]->date_debut_prevue;
286 if ($lines[$i]->date_debut_reel) $date_start = $lines[$i]->date_debut_reel;
287 if ($lines[$i]->date_start) $date_start = $lines[$i]->date_start;
290 if ($lines[$i]->date_fin_prevue) $date_end = $lines[$i]->date_fin_prevue;
291 if ($lines[$i]->date_fin_reel) $date_end = $lines[$i]->date_fin_reel;
292 if ($lines[$i]->date_end) $date_end = $lines[$i]->date_end;
294 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
298 $result = $object->addline(
300 $lines[$i]->subprice,
302 $lines[$i]->localtax1_tx,
303 $lines[$i]->localtax2_tx,
305 $lines[$i]->fk_product,
306 $lines[$i]->remise_percent,
310 $lines[$i]->info_bits,
319 $lines[$i]->ref_supplier
322 $rcp->add_object_linked(
'facture_fourn_det', $result);
333 if ($result > 0 && $lines[$i]->product_type == 9)
335 $fk_parent_line = $result;
344 if (!empty($createbills_onebythird) && empty($TFactThird[$rcp->socid])) $TFactThird[$rcp->socid] = $object;
345 else $TFact[$object->id] = $object;
349 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
352 if (!$error && $validate_invoices)
354 $massaction = $action =
'builddoc';
355 foreach ($TAllFact as &$object)
357 $result = $object->validate($user);
369 $upload_dir = $conf->fournisseur->facture->dir_output;
370 $permissiontoadd = $user->rights->fournisseur->facture->creer;
371 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
374 $massaction = $action =
'confirm_createbills';
384 $_GET[
"origin"] = $_POST[
"origin"];
385 $_GET[
"originid"] = $_POST[
"originid"];
397 $form =
new Form($db);
398 $companystatic =
new Societe($db);
404 $helpurl =
'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones';
405 llxHeader(
'', $langs->trans(
'ListOfReceptions'), $helpurl);
407 $sql =
"SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut, e.billed,";
408 $sql .=
' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
409 $sql .=
" typent.code as typent_code,";
410 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
411 $sql .=
' e.date_creation as date_creation, e.tms as date_update';
413 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
414 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
' as options_'.$key :
'');
417 $parameters = array();
418 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
419 $sql .= $hookmanager->resPrint;
420 $sql .=
" FROM ".MAIN_DB_PREFIX.
"reception as e";
421 if (is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (e.rowid = ef.fk_object)";
422 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
423 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
424 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
425 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
426 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'reception' AND ee.targettype = 'delivery'";
427 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"delivery as l ON l.rowid = ee.fk_target";
428 if (!$user->rights->societe->client->voir && !$socid)
430 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
432 $sql .=
" WHERE e.entity IN (".getEntity(
'reception').
")";
433 if (!$user->rights->societe->client->voir && !$socid)
435 $sql .=
" AND e.fk_soc = sc.fk_soc";
436 $sql .=
" AND sc.fk_user = ".$user->id;
440 $sql .=
" AND e.fk_soc = ".$socid;
442 if ($search_status <>
'' && $search_status >= 0) {
443 $sql .=
" AND e.fk_statut = ".$search_status;
445 if ($search_billed !=
'' && $search_billed >= 0) $sql .=
' AND e.billed = '.$search_billed;
448 if ($search_state) $sql .=
natural_search(
"state.nom", $search_state);
449 if ($search_country) $sql .=
" AND s.fk_pays IN (".$search_country.
')';
450 if ($search_type_thirdparty) $sql .=
" AND s.fk_typent IN (".$search_type_thirdparty.
')';
451 if ($search_ref_rcp) $sql .=
natural_search(
'e.ref', $search_ref_rcp);
452 if ($search_ref_liv) $sql .=
natural_search(
'l.ref', $search_ref_liv);
453 if ($search_company) $sql .=
natural_search(
's.nom', $search_company);
454 if ($search_ref_supplier) $sql .=
natural_search(
'e.ref_supplier', $search_ref_supplier);
455 if ($sall) $sql .=
natural_search(array_keys($fieldstosearchall), $sall);
458 foreach ($search_array_options as $key => $val)
461 $tmpkey = preg_replace(
'/search_options_/',
'', $key);
462 $typ = $extrafields->attributes[$object->table_element][
'type'][$tmpkey];
464 if (in_array($typ, array(
'int',
'double',
'real'))) $mode = 1;
465 if (in_array($typ, array(
'sellist')) && $crit !=
'0' && $crit !=
'-1') $mode = 2;
466 if ($crit !=
'' && (!in_array($typ, array(
'select',
'sellist')) || $crit !=
'0'))
472 $parameters = array();
473 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
474 $sql .= $hookmanager->resPrint;
476 $nbtotalofrecords =
'';
477 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
479 $result = $db->query($sql);
480 $nbtotalofrecords = $db->num_rows($result);
483 $sql .= $db->order($sortfield, $sortorder);
484 $sql .= $db->plimit($limit + 1, $offset);
487 $resql = $db->query($sql);
490 $num = $db->num_rows(
$resql);
494 $arrayofselected = is_array($toselect) ? $toselect : array();
497 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
498 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
499 if ($sall) $param .=
"&sall=".urlencode($sall);
500 if ($search_ref_rcp) $param .=
"&search_ref_rcp=".urlencode($search_ref_rcp);
501 if ($search_ref_liv) $param .=
"&search_ref_liv=".urlencode($search_ref_liv);
502 if ($search_company) $param .=
"&search_company=".urlencode($search_company);
503 if ($optioncss !=
'') $param .=
'&optioncss='.urlencode($optioncss);
504 if ($search_billed !=
'' && $search_billed >= 0) $param .=
"&search_billed=".urlencode($search_billed);
505 if ($search_town) $param .=
"&search_town=".urlencode($search_town);
506 if ($search_zip) $param .=
"&search_zip=".urlencode($search_zip);
507 if ($search_state) $param .=
"&search_state=".urlencode($search_state);
508 if ($search_status !=
'') $param .=
"&search_status=".urlencode($search_status);
509 if ($search_country) $param .=
"&search_country=".urlencode($search_country);
510 if ($search_type_thirdparty) $param .=
"&search_type_thirdparty=".urlencode($search_type_thirdparty);
511 if ($search_ref_supplier) $param .=
"&search_ref_supplier=".urlencode($search_ref_supplier);
513 foreach ($search_array_options as $key => $val)
516 $tmpkey = preg_replace(
'/search_options_/',
'', $key);
517 if ($val !=
'') $param .=
'&search_options_'.$tmpkey.
'='.urlencode($val);
521 $arrayofmassactions = array(
525 if ($user->rights->fournisseur->facture->creer)$arrayofmassactions[
'createbills'] = $langs->trans(
"CreateInvoiceForThisSupplier");
526 if ($massaction ==
'createbills') $arrayofmassactions = array();
527 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
531 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
532 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
533 print '<input type="hidden" name="token" value="'.newToken().
'">';
534 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
535 print '<input type="hidden" name="action" value="list">';
536 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
537 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
539 print_barre_liste($langs->trans(
'ListOfReceptions'), $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'dollyrevert', 0,
'',
'', $limit, 0, 0, 1);
542 if ($massaction ==
'createbills')
545 print '<input type="hidden" name="massaction" value="confirm_createbills">';
547 print '<table class="noborder" width="100%" >';
549 print '<td class="titlefieldmiddle">';
550 print $langs->trans(
'DateInvoice');
553 print $form->selectDate(
'',
'',
'',
'',
'',
'', 1, 1);
558 print $langs->trans(
'CreateOneBillByThird');
561 print $form->selectyesno(
'createbills_onebythird',
'', 1);
566 print $langs->trans(
'ValidateInvoices');
569 if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL))
571 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
572 print ' ('.$langs->trans(
"AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").
')';
574 print $form->selectyesno(
'validate_invoices', 0, 1);
581 print '<div class="center">';
582 print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisSupplier').
'"> ';
583 print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
590 foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
591 print $langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall);
595 if (!empty($moreforfilter))
597 print '<div class="liste_titre liste_titre_bydiv centpercent">';
598 print $moreforfilter;
599 $parameters = array(
'type'=>$type);
600 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
601 print $hookmanager->resPrint;
605 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
606 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
607 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
610 print '<div class="div-table-responsive">';
611 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
615 print '<tr class="liste_titre_filter">';
617 if (!empty($arrayfields[
'e.ref'][
'checked']))
619 print
'<td class="liste_titre">';
620 print
'<input class="flat" size="6" type="text" name="search_ref_rcp" value="'.$search_ref_rcp.
'">';
624 if (!empty($arrayfields[
'e.ref_supplier'][
'checked']))
626 print
'<td class="liste_titre">';
627 print
'<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$search_ref_supplier.
'">';
631 if (!empty($arrayfields[
's.nom'][
'checked']))
633 print
'<td class="liste_titre left">';
634 print
'<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
638 if (!empty($arrayfields[
's.town'][
'checked'])) print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
640 if (!empty($arrayfields[
's.zip'][
'checked'])) print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.
'"></td>';
642 if (!empty($arrayfields[
'state.nom'][
'checked']))
644 print
'<td class="liste_titre">';
645 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
649 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
651 print
'<td class="liste_titre center">';
652 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
656 if (!empty($arrayfields[
'typent.code'][
'checked']))
658 print
'<td class="liste_titre maxwidthonsmartphone center">';
659 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT));
663 if (!empty($arrayfields[
'e.date_delivery'][
'checked']))
665 print
'<td class="liste_titre"> </td>';
667 if (!empty($arrayfields[
'l.ref'][
'checked']))
670 print
'<td class="liste_titre">';
671 print
'<input class="flat" size="10" type="text" name="search_ref_liv" value="'.$search_ref_liv.
'"';
674 if (!empty($arrayfields[
'l.date_delivery'][
'checked']))
677 print
'<td class="liste_titre"> </td>';
680 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
683 $parameters = array(
'arrayfields'=>$arrayfields);
684 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
685 print $hookmanager->resPrint;
687 if (!empty($arrayfields[
'e.datec'][
'checked']))
689 print
'<td class="liste_titre">';
693 if (!empty($arrayfields[
'e.tms'][
'checked']))
695 print
'<td class="liste_titre">';
699 if (!empty($arrayfields[
'e.fk_statut'][
'checked']))
701 print
'<td class="liste_titre maxwidthonsmartphone right">';
702 print $form->selectarray(
'search_status', array(
'0'=>$langs->trans(
'StatusReceptionDraftShort'),
'1'=>$langs->trans(
'StatusReceptionValidatedShort'),
'2'=>$langs->trans(
'StatusReceptionProcessedShort')), $search_status, 1);
706 if (!empty($arrayfields[
'e.billed'][
'checked']))
708 print
'<td class="liste_titre maxwidthonsmartphone center">';
709 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1);
713 print
'<td class="liste_titre middle">';
714 $searchpicto = $form->showFilterAndCheckAddButtons(0);
719 print
'<tr class="liste_titre">';
720 if (!empty($arrayfields[
'e.ref'][
'checked']))
print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
'', $sortfield, $sortorder);
721 if (!empty($arrayfields[
'e.ref_supplier'][
'checked']))
print_liste_field_titre($arrayfields[
'e.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref_supplier",
"", $param,
'', $sortfield, $sortorder);
722 if (!empty($arrayfields[
's.nom'][
'checked']))
print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder,
'left ');
723 if (!empty($arrayfields[
's.town'][
'checked']))
print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
724 if (!empty($arrayfields[
's.zip'][
'checked']))
print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
725 if (!empty($arrayfields[
'state.nom'][
'checked']))
print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
726 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
727 if (!empty($arrayfields[
'typent.code'][
'checked']))
print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
728 if (!empty($arrayfields[
'e.date_delivery'][
'checked']))
print_liste_field_titre($arrayfields[
'e.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
"e.date_delivery",
"", $param,
'', $sortfield, $sortorder,
'center ');
729 if (!empty($arrayfields[
'l.ref'][
'checked']))
print_liste_field_titre($arrayfields[
'l.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"l.ref",
"", $param,
'', $sortfield, $sortorder);
730 if (!empty($arrayfields[
'l.date_delivery'][
'checked']))
print_liste_field_titre($arrayfields[
'l.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
"l.date_delivery",
"", $param,
'', $sortfield, $sortorder,
'center ');
732 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
734 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
735 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
736 print $hookmanager->resPrint;
737 if (!empty($arrayfields[
'e.datec'][
'checked']))
print_liste_field_titre($arrayfields[
'e.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"e.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
738 if (!empty($arrayfields[
'e.tms'][
'checked']))
print_liste_field_titre($arrayfields[
'e.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"e.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
739 if (!empty($arrayfields[
'e.fk_statut'][
'checked']))
print_liste_field_titre($arrayfields[
'e.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"e.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
740 if (!empty($arrayfields[
'e.billed'][
'checked']))
print_liste_field_titre($arrayfields[
'e.billed'][
'label'], $_SERVER[
"PHP_SELF"],
"e.billed",
"", $param,
'', $sortfield, $sortorder,
'center ');
741 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
745 $totalarray = array();
746 while ($i < min($num, $limit))
748 $obj = $db->fetch_object(
$resql);
750 $reception->id = $obj->rowid;
751 $reception->ref = $obj->ref;
753 $companystatic->id = $obj->socid;
754 $companystatic->ref = $obj->name;
755 $companystatic->name = $obj->name;
758 print
'<tr class="oddeven">';
761 if (!empty($arrayfields[
'e.ref'][
'checked']))
764 print $reception->getNomUrl(1);
767 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$reception->id;
768 print $formfile->getDocumentsLink($reception->element, $filename, $filedir);
771 if (!$i) $totalarray[
'nbfield']++;
775 if (!empty($arrayfields[
'e.ref_supplier'][
'checked']))
778 print $obj->ref_supplier;
780 if (!$i) $totalarray[
'nbfield']++;
784 if (!empty($arrayfields[
's.nom'][
'checked']))
787 print $companystatic->getNomUrl(1);
789 if (!$i) $totalarray[
'nbfield']++;
792 if (!empty($arrayfields[
's.town'][
'checked']))
794 print
'<td class="nocellnopadd">';
797 if (!$i) $totalarray[
'nbfield']++;
800 if (!empty($arrayfields[
's.zip'][
'checked']))
802 print
'<td class="nocellnopadd">';
805 if (!$i) $totalarray[
'nbfield']++;
808 if (!empty($arrayfields[
'state.nom'][
'checked']))
810 print
"<td>".$obj->state_name.
"</td>\n";
811 if (!$i) $totalarray[
'nbfield']++;
814 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
816 print
'<td class="center">';
818 print $tmparray[
'label'];
820 if (!$i) $totalarray[
'nbfield']++;
823 if (!empty($arrayfields[
'typent.code'][
'checked']))
825 print
'<td class="center">';
826 if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1);
827 print $typenArray[$obj->typent_code];
829 if (!$i) $totalarray[
'nbfield']++;
833 if (!empty($arrayfields[
'e.date_delivery'][
'checked']))
835 print
'<td class="center">';
844 if (!empty($arrayfields[
'l.ref'][
'checked']) || !empty($arrayfields[
'l.date_delivery'][
'checked']))
846 $reception->fetchObjectLinked($reception->id, $reception->element);
848 if (count($reception->linkedObjects[
'delivery']) > 0) $receiving = reset($reception->linkedObjects[
'delivery']);
850 if (!empty($arrayfields[
'l.ref'][
'checked']))
854 print !empty($receiving) ? $receiving->getNomUrl($db) :
'';
858 if (!empty($arrayfields[
'l.date_delivery'][
'checked']))
861 print
'<td class="center">';
868 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
871 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
872 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
873 print $hookmanager->resPrint;
875 if (!empty($arrayfields[
'e.datec'][
'checked']))
877 print
'<td class="center nowrap">';
880 if (!$i) $totalarray[
'nbfield']++;
883 if (!empty($arrayfields[
'e.tms'][
'checked']))
885 print
'<td class="center nowrap">';
888 if (!$i) $totalarray[
'nbfield']++;
891 if (!empty($arrayfields[
'e.fk_statut'][
'checked']))
893 print
'<td class="right nowrap">'.$reception->LibStatut($obj->fk_statut, 5).
'</td>';
894 if (!$i) $totalarray[
'nbfield']++;
897 if (!empty($arrayfields[
'e.billed'][
'checked']))
899 print
'<td class="center">'.yn($obj->billed).
'</td>';
900 if (!$i) $totalarray[
'nbfield']++;
904 print
'<td class="center">';
905 if ($massactionbutton || $massaction)
908 if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
909 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
912 if (!$i) $totalarray[
'nbfield']++;
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
const TYPE_STANDARD
Standard invoice.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
</td >< tdcolspan="3">< spanclass="opacitymedium"></span ></td ></tr >< trclass="liste_total"> CREANCES DETTES< tdcolspan="3"class="right"></td >< tdcolspan="3"class="right"></td ></tr > CREANCES DETTES RECETTES DEPENSES trips CREANCES DETTES Y m expensereport p date_valid Y m expensereport pe datep $db idate($date_start)."' AND $column < p rowid
setEventMessage($mesgs, $style= 'mesgs')
Set event message in dol_events session object.
Class to manage suppliers invoices.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
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.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Class to manage receptions.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Class to manage absolute discounts.
getCountry($searchkey, $withcode= '', $dbtouse=0, $outputlangs= '', $entconv=1, $searchlabel= '')
Return country label, code or id from an id, code or label.