42 global $db, $langs,
$conf, $user;
43 $langs->load(
"products");
45 $label = $langs->trans(
'Product');
46 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_prices') : $user->hasRight(
'product',
'read');
47 $usercancreadsupplierprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_supplier_prices') : $user->hasRight(
'product',
'read');
50 $label = $langs->trans(
'Service');
51 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_prices') : $user->hasRight(
'service',
'read');
52 $usercancreadsupplierprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_supplier_prices') : $user->hasRight(
'service',
'read');
58 $head[$h][0] = DOL_URL_ROOT.
"/product/card.php?id=".
$object->id;
59 $head[$h][1] = $label;
60 $head[$h][2] =
'card';
64 if ($usercancreadprice) {
65 $head[$h][0] = DOL_URL_ROOT.
"/product/price.php?id=".
$object->id;
66 $head[$h][1] = $langs->trans(
"SellingPrices");
67 $head[$h][2] =
'price';
71 $head[$h][1] = $langs->trans(
"SellingPrices");
72 $head[$h][2] =
'price';
73 $head[$h][5] =
'disabled';
79 if ((isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) && ($user->hasRight(
'fournisseur',
'lire') || $user->hasRight(
'supplier_order',
'read') || $user->hasRight(
'supplier_invoice',
'read'))
80 || (isModEnabled(
'margin') && $user->hasRight(
"margin",
"liretous"))
82 if ($usercancreadsupplierprice) {
83 $head[$h][0] = DOL_URL_ROOT.
"/product/price_suppliers.php?id=".
$object->id;
84 $head[$h][1] = $langs->trans(
"BuyingPrices");
85 $head[$h][2] =
'suppliers';
89 $head[$h][1] = $langs->trans(
"BuyingPrices");
90 $head[$h][2] =
'suppliers';
91 $head[$h][5] =
'disabled';
99 $head[$h][0] = DOL_URL_ROOT.
"/product/traduction.php?id=".
$object->id;
100 $head[$h][1] = $langs->trans(
"Translations");
101 $nbTranslations = !empty(
$object->multilangs) ? count(
$object->multilangs) : 0;
102 if ($nbTranslations > 0) {
103 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbTranslations.
'</span>';
105 $head[$h][2] =
'translation';
111 $head[$h][0] = DOL_URL_ROOT.
"/product/composition/card.php?id=".
$object->id;
112 $head[$h][1] = $langs->trans(
'AssociatedProducts');
114 $nbFatherAndChild =
$object->hasFatherOrChild();
115 if ($nbFatherAndChild > 0) {
116 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbFatherAndChild.
'</span>';
118 $head[$h][2] =
'subproduct';
122 if (isModEnabled(
'variants') && (
$object->isProduct() ||
$object->isService())) {
125 require_once DOL_DOCUMENT_ROOT.
'/variants/class/ProductCombination.class.php';
129 if ($prodcomb->fetchByFkProductChild(
$object->id) <= 0) {
130 $head[$h][0] = DOL_URL_ROOT.
"/variants/combinations.php?id=".
$object->id;
131 $head[$h][1] = $langs->trans(
'ProductCombinations');
132 $head[$h][2] =
'combinations';
133 $nbVariant = $prodcomb->countNbOfCombinationForFkProductParent(
$object->id);
134 if ($nbVariant > 0) {
135 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbVariant.
'</span>';
143 if (isModEnabled(
'stock') && $user->hasRight(
'stock',
'lire')) {
144 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/product.php?id=".
$object->id;
145 $head[$h][1] = $langs->trans(
"Stock");
146 $head[$h][2] =
'stock';
152 if (isModEnabled(
'resource')) {
154 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=product&ref='.
$object->ref;
155 $head[$h][1] = $langs->trans(
"Resources");
156 $head[$h][2] =
'resources';
160 $head[$h][0] = DOL_URL_ROOT.
'/resource/element_resource.php?element=service&ref='.
$object->ref;
161 $head[$h][1] = $langs->trans(
"Resources");
162 $head[$h][2] =
'resources';
167 $head[$h][0] = DOL_URL_ROOT.
"/product/stats/facture.php?showmessage=1&id=".
$object->id;
168 $head[$h][1] = $langs->trans(
'Referers');
169 $head[$h][2] =
'referers';
172 $head[$h][0] = DOL_URL_ROOT.
"/product/stats/card.php?id=".
$object->id;
173 $head[$h][1] = $langs->trans(
'Statistics');
174 $head[$h][2] =
'stats';
186 if (!empty(
$object->note_private)) {
189 if (!empty(
$object->note_public)) {
192 $head[$h][0] = DOL_URL_ROOT.
'/product/note.php?id='.
$object->id;
193 $head[$h][1] = $langs->trans(
'Notes');
195 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
197 $head[$h][2] =
'note';
202 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
203 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
211 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
219 $nbFiles += count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
222 $head[$h][0] = DOL_URL_ROOT.
'/product/document.php?id='.
$object->id;
223 $head[$h][1] = $langs->trans(
'Documents');
224 if (($nbFiles + $nbLinks) > 0) {
225 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
227 $head[$h][2] =
'documents';
231 $head[$h][0] = DOL_URL_ROOT.
'/product/messaging.php?id='.
$object->id;
232 $head[$h][1] = $langs->trans(
"Events");
233 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
235 $head[$h][1] .= $langs->trans(
"Agenda");
237 $head[$h][2] =
'agenda';
255 global $db, $langs,
$conf, $user;
258 $langs->loadLangs(array(
"products",
"productbatch"));
263 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/productlot_card.php?id=".
$object->id;
264 $head[$h][1] = $langs->trans(
"Lot");
265 $head[$h][2] =
'card';
268 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/stats/expedition.php?showmessage=1&id=".
$object->id;
269 $head[$h][1] = $langs->trans(
'Referers');
270 $head[$h][2] =
'referers';
274 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
275 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
277 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
279 $head[$h][0] = DOL_URL_ROOT.
"/product/stock/productlot_document.php?id=".
$object->id;
280 $head[$h][1] = $langs->trans(
"Documents");
281 if (($nbFiles + $nbLinks) > 0) {
282 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
284 $head[$h][2] =
'documents';
290 if (!empty(
$object->note_private)) {
293 if (!empty(
$object->note_public)) {
296 $head[$h][0] = DOL_URL_ROOT .
'/product/stock/productlot_note.php?id=' .
$object->id;
297 $head[$h][1] = $langs->trans(
'Notes');
299 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbNote .
'</span>';
301 $head[$h][2] =
'note';
333 global $langs,
$conf, $db;
336 $extrafields->fetch_name_optionals_label(
'product');
337 $extrafields->fetch_name_optionals_label(
'product_price');
338 $extrafields->fetch_name_optionals_label(
'product_customer_price');
339 $extrafields->fetch_name_optionals_label(
'product_fournisseur_price');
344 $head[$h][0] = DOL_URL_ROOT.
"/product/admin/product.php";
345 $head[$h][1] = $langs->trans(
'Parameters');
346 $head[$h][2] =
'general';
351 0 => DOL_URL_ROOT.
"/product/admin/price_rules.php",
352 1 => $langs->trans(
'MultipriceRules'),
364 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_extrafields.php';
365 $head[$h][1] = $langs->trans(
"ExtraFields");
366 $nbExtrafields = $extrafields->attributes[
'product'][
'count'];
367 if ($nbExtrafields > 0) {
368 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
370 $head[$h][2] =
'attributes';
375 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_price_extrafields.php';
376 $head[$h][1] = $langs->trans(
"ProductLevelExtraFields");
377 $nbExtrafields = $extrafields->attributes[
'product_price'][
'count'];
378 if ($nbExtrafields > 0) {
379 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
381 $head[$h][2] =
'levelAttributes';
387 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_customer_extrafields.php';
388 $head[$h][1] = $langs->trans(
"ProductCustomerExtraFields");
389 $nbExtrafields = $extrafields->attributes[
'product_customer_price'][
'count'];
390 if ($nbExtrafields > 0) {
391 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
393 $head[$h][2] =
'customerAttributes';
398 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_supplier_extrafields.php';
399 $head[$h][1] = $langs->trans(
"ProductSupplierExtraFields");
400 $nbExtrafields = $extrafields->attributes[
'product_fournisseur_price'][
'count'];
401 if ($nbExtrafields > 0) {
402 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
404 $head[$h][2] =
'supplierAttributes';
421 global $langs,
$conf, $user, $db;
424 $extrafields->fetch_name_optionals_label(
'product_lot');
429 $head[$h][0] = DOL_URL_ROOT.
"/product/admin/product_lot.php";
430 $head[$h][1] = $langs->trans(
'Parameters');
431 $head[$h][2] =
'settings';
440 $head[$h][0] = DOL_URL_ROOT.
'/product/admin/product_lot_extrafields.php';
441 $head[$h][1] = $langs->trans(
"ExtraFields");
442 $nbExtrafields = $extrafields->attributes[
'product_lot'][
'count'];
443 if ($nbExtrafields > 0) {
444 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
446 $head[$h][2] =
'attributes';
465 global $langs, $user, $db, $hookmanager;
467 $form =
new Form($db);
471 print
'<tr class="liste_titre">';
472 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
473 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
474 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
475 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
479 if (isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
481 $ret = $product->load_stats_propale($socid);
485 $langs->load(
"propal");
487 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/propal.php?id='.$product->id.
'">'.
img_object(
'',
'propal',
'class="pictofixedwidth"').$langs->trans(
"Proposals").
'</a>';
488 print
'</td><td class="right">';
489 print $product->stats_propale[
'customers'];
490 print
'</td><td class="right">';
491 print $product->stats_propale[
'nb'];
492 print
'</td><td class="right">';
493 print
price($product->stats_propale[
'qty'], 1, $langs, 0, 0);
498 if (isModEnabled(
'supplier_proposal') && $user->hasRight(
'supplier_proposal',
'lire')) {
500 $ret = $product->load_stats_proposal_supplier($socid);
504 $langs->load(
"supplier_proposal");
506 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/supplier_proposal.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_proposal',
'class="pictofixedwidth"').$langs->trans(
"SupplierProposals").
'</a>';
507 print
'</td><td class="right">';
508 print $product->stats_proposal_supplier[
'suppliers'];
509 print
'</td><td class="right">';
510 print $product->stats_proposal_supplier[
'nb'];
511 print
'</td><td class="right">';
512 print
price($product->stats_proposal_supplier[
'qty'], 1, $langs, 0, 0);
517 if (isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
519 $ret = $product->load_stats_commande($socid);
523 $langs->load(
"orders");
525 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/commande.php?id='.$product->id.
'">'.
img_object(
'',
'order',
'class="pictofixedwidth"').$langs->trans(
"CustomersOrders").
'</a>';
526 print
'</td><td class="right">';
527 print $product->stats_commande[
'customers'];
528 print
'</td><td class="right">';
529 print $product->stats_commande[
'nb'];
530 print
'</td><td class="right">';
531 print
price($product->stats_commande[
'qty'], 1, $langs, 0, 0);
536 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'commande',
'lire')) || (isModEnabled(
"supplier_order") && $user->hasRight(
'supplier_order',
'lire'))) {
538 $ret = $product->load_stats_commande_fournisseur($socid);
542 $langs->load(
"orders");
544 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/commande_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_order',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
545 print
'</td><td class="right">';
546 print $product->stats_commande_fournisseur[
'suppliers'];
547 print
'</td><td class="right">';
548 print $product->stats_commande_fournisseur[
'nb'];
549 print
'</td><td class="right">';
550 print
price($product->stats_commande_fournisseur[
'qty'], 1, $langs, 0, 0);
555 if (isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
557 $ret = $product->load_stats_facture($socid);
561 $langs->load(
"bills");
563 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facture.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CustomersInvoices").
'</a>';
564 print
'</td><td class="right">';
565 print $product->stats_facture[
'customers'];
566 print
'</td><td class="right">';
567 print $product->stats_facture[
'nb'];
568 print
'</td><td class="right">';
569 print
price($product->stats_facture[
'qty'], 1, $langs, 0, 0);
574 if (isModEnabled(
"invoice") && $user->hasRight(
'facture',
'lire')) {
576 $ret = $product->load_stats_facturerec($socid);
580 $langs->load(
"bills");
582 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facturerec.php?id='.$product->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"RecurringInvoiceTemplate").
'</a>';
583 print
'</td><td class="right">';
584 print $product->stats_facturerec[
'customers'];
585 print
'</td><td class="right">';
586 print $product->stats_facturerec[
'nb'];
587 print
'</td><td class="right">';
588 print $product->stats_facturerec[
'qty'];
593 if ((isModEnabled(
"fournisseur") && !
getDolGlobalString(
'MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight(
'fournisseur',
'facture',
'lire')) || (isModEnabled(
"supplier_invoice") && $user->hasRight(
'supplier_invoice',
'lire'))) {
595 $ret = $product->load_stats_facture_fournisseur($socid);
599 $langs->load(
"bills");
601 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/facture_fournisseur.php?id='.$product->id.
'">'.
img_object(
'',
'supplier_invoice',
'class="pictofixedwidth"').$langs->trans(
"SuppliersInvoices").
'</a>';
602 print
'</td><td class="right">';
603 print $product->stats_facture_fournisseur[
'suppliers'];
604 print
'</td><td class="right">';
605 print $product->stats_facture_fournisseur[
'nb'];
606 print
'</td><td class="right">';
607 print
price($product->stats_facture_fournisseur[
'qty'], 1, $langs, 0, 0);
634 if (isModEnabled(
'shipping') && $user->hasRight(
'shipping',
'lire')) {
636 $ret = $product->load_stats_sending($socid);
640 $langs->load(
"sendings");
642 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/expedition.php?id='.$product->id.
'">'.
img_object(
'',
'shipment',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
643 print
'</td><td class="right">';
644 print $product->stats_expedition[
'customers'];
645 print
'</td><td class="right">';
646 print $product->stats_expedition[
'nb'];
647 print
'</td><td class="right">';
648 print $product->stats_expedition[
'qty'];
654 if ((isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire'))) {
656 $ret = $product->load_stats_reception($socid);
660 $langs->load(
"receptions");
662 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/reception.php?id='.$product->id.
'">'.
img_object(
'',
'reception',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
663 print
'</td><td class="right">';
664 print $product->stats_reception[
'suppliers'];
665 print
'</td><td class="right">';
666 print $product->stats_reception[
'nb'];
667 print
'</td><td class="right">';
668 print $product->stats_reception[
'qty'];
674 if (isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
676 $ret = $product->load_stats_contrat($socid);
680 $langs->load(
"contracts");
682 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/contrat.php?id='.$product->id.
'">'.
img_object(
'',
'contract',
'class="pictofixedwidth"').$langs->trans(
"Contracts").
'</a>';
683 print
'</td><td class="right">';
684 print $product->stats_contrat[
'customers'];
685 print
'</td><td class="right">';
686 print $product->stats_contrat[
'nb'];
687 print
'</td><td class="right">';
688 print
price($product->stats_contrat[
'qty'], 1, $langs, 0, 0);
694 if (isModEnabled(
'bom') && $user->hasRight(
'bom',
'read')) {
696 $ret = $product->load_stats_bom($socid);
703 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/bom.php?id='.$product->id.
'">'.
img_object(
'',
'bom',
'class="pictofixedwidth"').$langs->trans(
"BOM").
'</a>';
704 print
'</td><td class="right">';
706 print
'</td><td class="right">';
707 print $form->textwithpicto((
string) $product->stats_bom[
'nb_toconsume'], $langs->trans(
"RowMaterial"));
709 print $form->textwithpicto((
string) $product->stats_bom[
'nb_toproduce'], $langs->trans(
"Finished"));
710 print
'</td><td class="right">';
711 print $form->textwithpicto((
string) $product->stats_bom[
'qty_toconsume'], $langs->trans(
"RowMaterial"));
713 print $form->textwithpicto((
string) $product->stats_bom[
'qty_toproduce'], $langs->trans(
"Finished"));
719 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
721 $ret = $product->load_stats_mo($socid);
727 print
'<a href="'.DOL_URL_ROOT.
'/product/stats/mo.php?id='.$product->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
728 print
'</td><td class="right">';
729 print $form->textwithpicto((
string) $product->stats_mo[
'customers_toconsume'], $langs->trans(
"ToConsume"));
731 print $form->textwithpicto((
string) $product->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
733 print $form->textwithpicto((
string) $product->stats_mo[
'customers_toproduce'], $langs->trans(
"QtyToProduce"));
735 print $form->textwithpicto((
string) $product->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
736 print
'</td><td class="right">';
737 print $form->textwithpicto((
string) $product->stats_mo[
'nb_toconsume'], $langs->trans(
"ToConsume"));
739 print $form->textwithpicto((
string) $product->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
741 print $form->textwithpicto((
string) $product->stats_mo[
'nb_toproduce'], $langs->trans(
"QtyToProduce"));
743 print $form->textwithpicto((
string) $product->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
744 print
'</td><td class="right">';
745 print $form->textwithpicto((
string) $product->stats_mo[
'qty_toconsume'], $langs->trans(
"ToConsume"));
747 print $form->textwithpicto((
string) $product->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
749 print $form->textwithpicto((
string) $product->stats_mo[
'qty_toproduce'], $langs->trans(
"QtyToProduce"));
751 print $form->textwithpicto((
string) $product->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
755 $parameters = array(
'socid' => $socid);
756 $reshook = $hookmanager->executeHooks(
'addMoreProductStat', $parameters, $product, $nblines);
761 print $hookmanager->resPrint;
776 global
$conf, $langs, $user, $db, $hookmanager;
778 $langs->LoadLangs(array(
'sendings',
'orders',
'receptions'));
780 $form =
new Form($db);
784 print
'<tr class="liste_titre">';
785 print
'<td class="left" width="25%">'.$langs->trans(
"Referers").
'</td>';
786 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfThirdParties").
'</td>';
787 print
'<td class="right" width="25%">'.$langs->trans(
"NbOfObjectReferers").
'</td>';
788 print
'<td class="right" width="25%">'.$langs->trans(
"TotalQuantity").
'</td>';
792 if (isModEnabled(
'shipping') && $user->hasRight(
'expedition',
'lire')) {
794 $ret = $batch->loadStatsExpedition($socid);
798 $langs->load(
"bills");
800 print
'<a href="'.dol_buildpath(
'/product/stock/stats/expedition.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Shipments").
'</a>';
801 print
'</td><td class="right">';
802 print $batch->stats_expedition[
'customers'];
803 print
'</td><td class="right">';
804 print $batch->stats_expedition[
'nb'];
805 print
'</td><td class="right">';
806 print $batch->stats_expedition[
'qty'];
811 if (isModEnabled(
"reception") && $user->hasRight(
'reception',
'lire')) {
813 $ret = $batch->loadStatsReception($socid);
817 $langs->load(
"bills");
819 print
'<a href="'.dol_buildpath(
'/product/stock/stats/reception.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"Receptions").
'</a>';
820 print
'</td><td class="right">';
821 print $batch->stats_reception[
'customers'];
822 print
'</td><td class="right">';
823 print $batch->stats_reception[
'nb'];
824 print
'</td><td class="right">';
825 print $batch->stats_reception[
'qty'];
828 } elseif (isModEnabled(
'supplier_order') && $user->hasRight(
'fournisseur',
'commande',
'lire')) {
830 $ret = $batch->loadStatsSupplierOrder($socid);
834 $langs->load(
"bills");
836 print
'<a href="'.dol_buildpath(
'/product/stock/stats/commande_fournisseur.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"SuppliersOrders").
'</a>';
837 print
'</td><td class="right">';
838 print $batch->stats_supplier_order[
'customers'];
839 print
'</td><td class="right">';
840 print $batch->stats_supplier_order[
'nb'];
841 print
'</td><td class="right">';
842 print $batch->stats_supplier_order[
'qty'];
847 if (isModEnabled(
'mrp') && $user->hasRight(
'mrp',
'read')) {
849 $ret = $batch->loadStatsMo($socid);
855 print
'<a href="'.dol_buildpath(
'/product/stock/stats/mo.php', 1).
'?id='.$batch->id.
'">'.
img_object(
'',
'mrp',
'class="pictofixedwidth"').$langs->trans(
"MO").
'</a>';
856 print
'</td><td class="right">';
858 print $form->textwithpicto((
string) $batch->stats_mo[
'customers_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
860 print $form->textwithpicto((
string) $batch->stats_mo[
'customers_produced'], $langs->trans(
"QtyAlreadyProduced"));
861 print
'</td><td class="right">';
863 print $form->textwithpicto((
string) $batch->stats_mo[
'nb_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
865 print $form->textwithpicto((
string) $batch->stats_mo[
'nb_produced'], $langs->trans(
"QtyAlreadyProduced"));
866 print
'</td><td class="right">';
868 print $form->textwithpicto((
string) $batch->stats_mo[
'qty_consumed'], $langs->trans(
"QtyAlreadyConsumed"));
870 print $form->textwithpicto((
string) $batch->stats_mo[
'qty_produced'], $langs->trans(
"QtyAlreadyProduced"));
875 $parameters = array(
'socid' => $socid);
876 $reshook = $hookmanager->executeHooks(
'addMoreBatchProductStat', $parameters, $batch, $nblines);
881 print $hookmanager->resPrint;
899function measuring_units_string($unitscale =
null, $measuring_style =
'', $unitid = 0, $use_short_label = 0, $outputlangs =
null)
901 return measuringUnitString($unitid, $measuring_style, $unitscale, $use_short_label, $outputlangs);
915function measuringUnitString($unitid, $measuring_style =
'', $unitscale =
null, $use_short_label = 0, $outputlangs =
null)
918 global $measuring_unit_cache;
920 if (empty($outputlangs)) {
921 $outputlangs = $langs;
924 if (empty($measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label])) {
925 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
926 $measuringUnits =
new CUnits($db);
928 if ($measuring_style ==
'' && $unitscale ==
'') {
929 $arrayforfilter = array(
930 't.rowid' => $unitid,
933 } elseif ($unitscale !==
'') {
934 $arrayforfilter = array(
935 't.scale' => $unitscale,
936 't.unit_type' => $measuring_style,
940 $arrayforfilter = array(
941 't.rowid' => $unitid,
942 't.unit_type' => $measuring_style,
946 $result = $measuringUnits->fetchAll(
'',
'', 0, 0, $arrayforfilter);
951 if (is_array($measuringUnits->records) && count($measuringUnits->records) > 0) {
952 if ($use_short_label == 1) {
953 $labeltoreturn = $measuringUnits->records[key($measuringUnits->records)]->short_label;
954 } elseif ($use_short_label == 2) {
955 $labeltoreturn = $outputlangs->transnoentitiesnoconv(ucfirst($measuringUnits->records[key($measuringUnits->records)]->label).
'Short');
957 $labeltoreturn = $outputlangs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label);
962 $measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label] = $labeltoreturn;
963 return $labeltoreturn;
966 return $measuring_unit_cache[$unitid.
'_'.$measuring_style.
'_'.$unitscale.
'_'.$use_short_label];
979 $measuring_units = array();
980 $measuring_units[0] = 0;
981 $measuring_units[-1] = -2;
982 $measuring_units[-2] = -4;
983 $measuring_units[-3] = -6;
984 $measuring_units[98] = 98;
985 $measuring_units[99] = 99;
986 return $measuring_units[$unitscale];
999 $measuring_units = array();
1000 $measuring_units[0] = 0;
1001 $measuring_units[-1] = -3;
1002 $measuring_units[-2] = -6;
1003 $measuring_units[-3] = -9;
1004 $measuring_units[98] = 88;
1005 $measuring_units[99] = 89;
1006 return $measuring_units[$unit];
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class of dictionary type of thirdparty (used by imports)
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class ProductCombination Used to represent the relation between a product and one of its variants.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
measuring_units_squared($unitscale)
Transform a given unit scale into the square of that unit, if known.
show_stats_for_batch($batch, $socid)
Show stats for product batch.
measuringUnitString($unitid, $measuring_style='', $unitscale=null, $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
product_prepare_head($object)
Prepare array with list of tabs.
product_admin_prepare_head()
Return array head with list of tabs to view object information.
show_stats_for_company($product, $socid)
Show stats for a product.
productlot_prepare_head($object)
Prepare array with list of tabs.
measuring_units_string($unitscale=null, $measuring_style='', $unitid=0, $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
product_lot_admin_prepare_head()
Return array head with list of tabs to view object information.
measuring_units_cubed($unit)
Transform a given unit scale into the cube of that unit, if known.