34require
'../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/product/dynamic_price/class/price_parser.class.php';
47$type =
GETPOST(
"type",
'intcomma');
48if ($type ==
'' && !$user->hasRight(
'produit',
'lire') && $user->hasRight(
'service',
'lire')) {
51if ($type ==
'' && !$user->hasRight(
'service',
'lire') && $user->hasRight(
'produit',
'lire')) {
56$langs->loadLangs(array(
'products',
'stocks'));
59$hookmanager->initHooks(array(
'productindex'));
67} elseif ($type ==
'1') {
70 $result =
restrictedArea($user,
'produit|service|expedition|reception');
78 require_once DOL_DOCUMENT_ROOT.
'/core/class/infobox.class.php';
81 $boxorder =
GETPOST(
'boxorder',
'aZ09');
82 $boxorder .=
GETPOST(
'boxcombo',
'aZ09');
99$transAreaType = $langs->trans(
"ProductsAndServicesArea");
102if (!GETPOSTISSET(
"type")) {
103 $transAreaType = $langs->trans(
"ProductsAndServicesArea");
104 $helpurl =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
107 $transAreaType = $langs->trans(
"ProductsArea");
108 $helpurl =
'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
111 $transAreaType = $langs->trans(
"ServicesArea");
112 $helpurl =
'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
115llxHeader(
"", $langs->trans(
"ProductsAndServices"), $helpurl,
'', 0, 0,
'',
'',
'',
'mod-product page-index');
117print
load_fiche_titre($transAreaType, $resultboxes[
'selectboxlist'],
'product');
121 $listofsearchfields = array();
124 if ((
isModEnabled(
"product") ||
isModEnabled(
"service")) && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
125 $listofsearchfields[
'search_product'] = array(
'text' =>
'ProductOrService');
128 if (count($listofsearchfields)) {
129 print
'<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
130 print
'<input type="hidden" name="token" value="'.newToken().
'">';
131 print
'<div class="div-table-responsive-no-min">';
132 print
'<table class="noborder nohover centpercent">';
134 foreach ($listofsearchfields as $key => $value) {
136 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
138 print
'<tr class="oddeven">';
139 print
'<td class="nowrap"><label for="'.$key.
'">'.$langs->trans($value[
"text"]).
'</label></td>';
140 print
'<td><input type="text" class="flat inputsearch" name="'.$key.
'" id="'.$key.
'" size="18"></td>';
142 print
'<td rowspan="'.count($listofsearchfields).
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
158if ((
isModEnabled(
"product") ||
isModEnabled(
"service")) && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
160 $prodser[0][0] = $prodser[0][1] = $prodser[0][2] = $prodser[0][3] = 0;
161 $prodser[0][
'sell'] = 0;
162 $prodser[0][
'buy'] = 0;
163 $prodser[0][
'none'] = 0;
164 $prodser[1][0] = $prodser[1][1] = $prodser[1][2] = $prodser[1][3] = 0;
165 $prodser[1][
'sell'] = 0;
166 $prodser[1][
'buy'] = 0;
167 $prodser[1][
'none'] = 0;
169 $sql =
"SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy";
170 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p";
171 $sql .=
' WHERE p.entity IN ('.getEntity($product_static->element, 1).
')';
173 $parameters = array();
174 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $product_static);
175 $sql .= $hookmanager->resPrint;
176 $sql .=
" GROUP BY p.fk_product_type, p.tosell, p.tobuy";
177 $result =
$db->query($sql);
178 while ($objp =
$db->fetch_object($result)) {
180 if (!$objp->tosell && !$objp->tobuy) {
183 if ($objp->tosell && !$objp->tobuy) {
186 if (!$objp->tosell && $objp->tobuy) {
189 $prodser[$objp->fk_product_type][$status] = $objp->total;
191 $prodser[$objp->fk_product_type][
'sell'] += $objp->total;
194 $prodser[$objp->fk_product_type][
'buy'] += $objp->total;
196 if (!$objp->tosell && !$objp->tobuy) {
197 $prodser[$objp->fk_product_type][
'none'] += $objp->total;
201 if (
$conf->use_javascript_ajax) {
202 $graph .=
'<div class="div-table-responsive-no-min">';
203 $graph .=
'<table class="noborder centpercent">';
204 $graph .=
'<tr class="liste_titre"><th>'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"ProductStatus").
'</th></tr>';
205 $graph .=
'<tr><td class="center nopaddingleftimp nopaddingrightimp">';
207 $SommeA = $prodser[0][
'sell'];
208 $SommeB = $prodser[0][
'buy'];
209 $SommeC = $prodser[0][
'none'];
210 $SommeD = $prodser[1][
'sell'];
211 $SommeE = $prodser[1][
'buy'];
212 $SommeF = $prodser[1][
'none'];
215 $datalabels = array();
218 $total = $SommeA + $SommeB + $SommeC + $SommeD + $SommeE + $SommeF;
219 $dataseries = array();
221 $dataseries[] = array($langs->transnoentitiesnoconv(
"ProductsOnSale"), round($SommeA));
222 $dataseries[] = array($langs->transnoentitiesnoconv(
"ProductsOnPurchase"), round($SommeB));
223 $dataseries[] = array($langs->transnoentitiesnoconv(
"ProductsNotOnSell"), round($SommeC));
226 $dataseries[] = array($langs->transnoentitiesnoconv(
"ServicesOnSale"), round($SommeD));
227 $dataseries[] = array($langs->transnoentitiesnoconv(
"ServicesOnPurchase"), round($SommeE));
228 $dataseries[] = array($langs->transnoentitiesnoconv(
"ServicesNotOnSell"), round($SommeF));
230 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
232 $dolgraph->SetData($dataseries);
233 $dolgraph->setShowLegend(2);
234 $dolgraph->setShowPercent(0);
235 $dolgraph->SetType(array(
'pie'));
236 $dolgraph->setHeight(
'200');
237 $dolgraph->draw(
'idgraphstatus');
238 $graph .= $dolgraph->show($total ? 0 : 1);
240 $graph .=
'</td></tr>';
241 $graph .=
'</table>';
249 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
251 $graphcat .=
'<div class="div-table-responsive-no-min">';
252 $graphcat .=
'<table class="noborder centpercent">';
253 $graphcat .=
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Categories").
'</th></tr>';
254 $graphcat .=
'<tr><td class="center" colspan="2">';
255 $sql =
"SELECT c.label, count(*) as nb";
256 $sql .=
" FROM ".MAIN_DB_PREFIX.
"categorie_product as cs";
257 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"categorie as c ON cs.fk_categorie = c.rowid";
258 $sql .=
" WHERE c.type = 0";
259 $sql .=
" AND c.entity IN (".getEntity(
'category').
")";
260 $sql .=
" GROUP BY c.label";
261 $sql .=
" ORDER BY nb desc";
263 $result =
$db->query($sql);
265 $num =
$db->num_rows($result);
267 if (!empty(
$conf->use_javascript_ajax)) {
268 $dataseries = array();
273 $obj =
$db->fetch_object($result);
275 $dataseries[] = array($obj->label, round($obj->nb));
283 $dataseries[] = array($langs->transnoentitiesnoconv(
"Other"), round($rest));
285 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
287 $dolgraph->SetData($dataseries);
288 $dolgraph->setShowLegend(2);
289 $dolgraph->setShowPercent(1);
290 $dolgraph->SetType(array(
'pie'));
291 $dolgraph->setHeight(
'200');
292 $dolgraph->draw(
'idstatscategproduct');
293 $graphcat .= $dolgraph->show($total ? 0 : 1);
296 $obj =
$db->fetch_object($result);
298 $graphcat .=
'<tr><td>'.$obj->label.
'</td><td>'.$obj->nb.
'</td></tr>';
304 $graphcat .=
'</td></tr>';
305 $graphcat .=
'<tr class="liste_total"><td>'.$langs->trans(
"Total").
'</td><td class="right">';
307 $graphcat .=
'</td></tr>';
308 $graphcat .=
'</table>';
309 $graphcat .=
'</div>';
318if ((
isModEnabled(
"product") ||
isModEnabled(
"service")) && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
319 $sql =
"SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy, p.tobatch, p.fk_price_expression,";
320 $sql .=
" p.entity,";
321 $sql .=
" GREATEST(p.tms, pef.tms) as datem";
322 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p";
323 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product_extrafields as pef ON pef.fk_object=p.rowid";
324 $sql .=
" WHERE p.entity IN (".getEntity($product_static->element, 1).
")";
328 if (!$user->hasRight(
"produit",
"lire")) {
331 if (!$user->hasRight(
"service",
"lire")) {
336 $parameters = array();
337 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $product_static);
338 $sql .= $hookmanager->resPrint;
339 $sql .=
$db->order(
"datem",
"DESC");
340 $sql .=
$db->plimit($max, 0);
343 $result =
$db->query($sql);
345 $num =
$db->num_rows($result);
350 $transRecordedType = $langs->trans(
"LastModifiedProductsAndServices", $max);
352 $transRecordedType = $langs->trans(
"LastRecordedProducts", $max);
355 $transRecordedType = $langs->trans(
"LastRecordedServices", $max);
358 $lastmodified .=
'<div class="div-table-responsive-no-min">';
359 $lastmodified .=
'<table class="noborder centpercent">';
366 $lastmodified .=
'<tr class="liste_titre"><th colspan="'.$colnb.
'">';
367 $lastmodified .= $transRecordedType;
368 $lastmodified .=
'<a href="'.DOL_URL_ROOT.
'/product/list.php?sortfield=p.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
369 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
370 $lastmodified .=
'</a>';
379 $lastmodified .=
'</th>';
380 $lastmodified .=
'<th>';
381 $lastmodified .=
'</th>';
382 $lastmodified .=
'<th>';
383 $lastmodified .=
'</th>';
384 $lastmodified .=
'<th>';
385 $lastmodified .=
'</th>';
386 $lastmodified .=
'</tr>';
389 $objp =
$db->fetch_object($result);
391 $product_static->id = $objp->rowid;
392 $product_static->ref = $objp->ref;
393 $product_static->label = $objp->label;
394 $product_static->type = $objp->fk_product_type;
395 $product_static->entity = $objp->entity;
396 $product_static->status = $objp->tosell;
397 $product_static->status_buy = $objp->tobuy;
398 $product_static->status_batch = $objp->tobatch;
400 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'product',
'product_advance',
'read_prices') : $user->hasRight(
'product',
'read');
401 if ($product_static->isService()) {
402 $usercancreadprice =
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') ? $user->hasRight(
'service',
'service_advance',
'read_prices') : $user->hasRight(
'service',
'read');
407 $sql =
"SELECT label";
408 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
409 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
410 $sql .=
" AND lang = '".$db->escape($langs->getDefaultLang()).
"'";
412 $resultd =
$db->query($sql);
414 $objtp =
$db->fetch_object($resultd);
415 if ($objtp && $objtp->label !=
'') {
416 $objp->label = $objtp->label;
422 $lastmodified .=
'<tr class="oddeven">';
423 $lastmodified .=
'<td class="nowraponall tdoverflowmax100">';
424 $lastmodified .= $product_static->getNomUrl(1);
425 $lastmodified .=
"</td>\n";
426 $lastmodified .=
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->label).
'">'.
dol_escape_htmltag($objp->label).
'</td>';
427 $lastmodified .=
'<td title="'.dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date(
$db->jdate($objp->datem),
'dayhour',
'tzuserrel')).
'">';
429 $lastmodified .=
"</td>";
432 if (
isModEnabled(
'dynamicprices') && !empty($objp->fk_price_expression)) {
434 $product->fetch($objp->rowid);
436 require_once DOL_DOCUMENT_ROOT.
'/product/dynamic_price/class/price_parser.class.php';
438 $price_result = $priceparser->parseProduct($product);
439 if ($price_result >= 0) {
440 $objp->price = $price_result;
443 $lastmodified .=
'<td class="nowraponall amount right">';
444 if ($usercancreadprice) {
445 if (isset($objp->price_base_type) && $objp->price_base_type ==
'TTC') {
446 $lastmodified .=
price($objp->price_ttc).
' '.$langs->trans(
"TTC");
448 $lastmodified .=
price($objp->price).
' '.$langs->trans(
"HT");
451 $lastmodified .=
'</td>';
453 $lastmodified .=
'<td class="right nowrap width25"><span class="statusrefsell">';
454 $lastmodified .= $product_static->LibStatut($objp->tosell, 3, 0);
455 $lastmodified .=
"</span></td>";
456 $lastmodified .=
'<td class="right nowrap width25"><span class="statusrefbuy">';
457 $lastmodified .= $product_static->LibStatut($objp->tobuy, 3, 1);
458 $lastmodified .=
"</span></td>";
459 $lastmodified .=
"</tr>\n";
465 $lastmodified .=
"</table>";
466 $lastmodified .=
'</div>';
467 $lastmodified .=
'<br>';
475$latestwarehouse =
'';
476if (
isModEnabled(
'stock') && $user->hasRight(
'stock',
'read')) {
477 $sql =
"SELECT e.rowid, e.ref as label, e.lieu, e.statut as status";
478 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e";
480 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
481 $sql .=
$db->order(
'e.tms',
'DESC');
482 $sql .=
$db->plimit($max + 1, 0);
484 $result =
$db->query($sql);
487 $num =
$db->num_rows($result);
489 $latestwarehouse .=
'<div class="div-table-responsive-no-min">';
490 $latestwarehouse .=
'<table class="noborder centpercent">';
491 $latestwarehouse .=
'<tr class="liste_titre">';
492 $latestwarehouse .=
'<th>';
493 $latestwarehouse .= $langs->trans(
"LatestModifiedWarehouses", $max);
498 $latestwarehouse .=
'<a href="'.DOL_URL_ROOT.
'/product/stock/list.php?sortfield=p.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
499 $latestwarehouse .=
'<span class="badge marginleftonlyshort">...</span>';
500 $latestwarehouse .=
'</a>';
501 $latestwarehouse .=
'</th><th class="right">';
502 $latestwarehouse .=
'</th>';
503 $latestwarehouse .=
'</tr>';
507 while ($i < min($max, $num)) {
508 $objp =
$db->fetch_object($result);
510 $warehouse->id = $objp->rowid;
511 $warehouse->statut = $objp->status;
512 $warehouse->label = $objp->label;
513 $warehouse->lieu = $objp->lieu;
515 $latestwarehouse .=
'<tr class="oddeven">';
516 $latestwarehouse .=
'<td>';
517 $latestwarehouse .= $warehouse->getNomUrl(1);
518 $latestwarehouse .=
'</td>'.
"\n";
519 $latestwarehouse .=
'<td class="right">';
520 $latestwarehouse .= $warehouse->getLibStatut(5);
521 $latestwarehouse .=
'</td>';
522 $latestwarehouse .=
"</tr>\n";
527 $latestwarehouse .=
'<tr><td>'.$langs->trans(
"None").
'</td><td></td></tr>';
533 $latestwarehouse .=
"</table>";
534 $latestwarehouse .=
'</div>';
535 $latestwarehouse .=
'<br>';
543if (
isModEnabled(
'stock') && $user->hasRight(
'stock',
'mouvement',
'read')) {
544 include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/mouvementstock.class.php';
546 $sql =
"SELECT p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.tobatch, p.tosell, p.tobuy,";
547 $sql .=
" e.ref as warehouse_ref, e.rowid as warehouse_id, e.ref as warehouse_label, e.lieu, e.statut as warehouse_status,";
548 $sql .=
" m.rowid as mid, m.label as mlabel, m.inventorycode as mcode, m.value as qty, m.datem, m.batch, m.eatby, m.sellby";
549 $sql .=
" FROM ".MAIN_DB_PREFIX.
"entrepot as e";
550 $sql .=
", ".MAIN_DB_PREFIX.
"stock_mouvement as m";
551 $sql .=
", ".MAIN_DB_PREFIX.
"product as p";
552 $sql .=
" WHERE m.fk_product = p.rowid";
553 $sql .=
" AND m.fk_entrepot = e.rowid";
554 $sql .=
" AND e.entity IN (".getEntity(
'stock').
")";
556 $sql .=
" AND p.fk_product_type = ".Product::TYPE_PRODUCT;
558 $sql .=
$db->order(
"datem",
"DESC");
559 $sql .=
$db->plimit($max, 0);
561 dol_syslog(
"Index:list stock movements", LOG_DEBUG);
563 $resql =
$db->query($sql);
565 $num =
$db->num_rows($resql);
567 $latestmovement .=
'<div class="div-table-responsive-no-min">';
568 $latestmovement .=
'<table class="noborder centpercent">';
569 $latestmovement .=
'<tr class="liste_titre">';
570 $latestmovement .=
'<th colspan="3">'.$langs->trans(
"LatestStockMovements", min($num, $max));
571 $latestmovement .=
'<a class="notasortlink" href="'.DOL_URL_ROOT.
'/product/stock/movement_list.php">';
572 $latestmovement .=
'<span class="badge marginleftonlyshort">...</span>';
574 $latestmovement .=
'</a>';
575 $latestmovement .=
'</th>';
577 $latestmovement .=
'<th></th>';
579 $latestmovement .=
'<th></th>';
580 $latestmovement .=
'<th class="right">';
581 $latestmovement .=
'</th>';
582 $latestmovement .=
"</tr>\n";
588 while ($i < min($num, $max)) {
589 $objp =
$db->fetch_object($resql);
591 $tmpstockmovement->id = $objp->mid;
592 $tmpstockmovement->date =
$db->jdate($objp->datem);
593 $tmpstockmovement->label = $objp->mlabel;
594 $tmpstockmovement->inventorycode = $objp->mcode;
595 $tmpstockmovement->qty = $objp->qty;
597 $producttmp->id = $objp->product_id;
598 $producttmp->ref = $objp->product_ref;
599 $producttmp->label = $objp->product_label;
600 $producttmp->status_batch = $objp->tobatch;
601 $producttmp->status_sell = $objp->tosell;
602 $producttmp->status_buy = $objp->tobuy;
604 $warehouse->id = $objp->warehouse_id;
605 $warehouse->ref = $objp->warehouse_ref;
606 $warehouse->statut = $objp->warehouse_status;
607 $warehouse->label = $objp->warehouse_label;
608 $warehouse->lieu = $objp->lieu;
610 $tmplotstatic->batch = $objp->batch;
611 $tmplotstatic->sellby = $objp->sellby;
612 $tmplotstatic->eatby = $objp->eatby;
614 $latestmovement .=
'<tr class="oddeven">';
615 $latestmovement .=
'<td class="nowraponall">';
616 $latestmovement .= $tmpstockmovement->getNomUrl(1);
618 $latestmovement .=
'</td>';
619 $latestmovement .=
'<td class="nowraponall">';
620 $latestmovement .=
dol_print_date($tmpstockmovement->date,
'dayhour',
'tzuserrel');
621 $latestmovement .=
"</td>\n";
622 $latestmovement .=
'<td class="tdoverflowmax150">';
623 $latestmovement .= $producttmp->getNomUrl(1);
624 $latestmovement .=
"</td>\n";
626 $latestmovement .=
'<td>';
627 $latestmovement .= $tmplotstatic->getNomUrl(0,
'nolink');
628 $latestmovement .=
'</td>';
636 $latestmovement .=
'<td class="tdoverflowmax150">';
637 $latestmovement .= $warehouse->getNomUrl(1);
638 $latestmovement .=
"</td>\n";
639 $latestmovement .=
'<td class="right">';
640 if ($objp->qty < 0) {
641 $latestmovement .=
'<span class="stockmovementexit">';
643 if ($objp->qty > 0) {
644 $latestmovement .=
'<span class="stockmovemententry">';
645 $latestmovement .=
'+';
647 $latestmovement .= $objp->qty;
648 $latestmovement .=
'</span>';
649 $latestmovement .=
'</td>';
650 $latestmovement .=
"</tr>\n";
660 $latestmovement .=
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
663 $latestmovement .=
"</table>";
664 $latestmovement .=
'</div>';
665 $latestmovement .=
'<br>';
688print
'<div class="clearboth"></div>';
689print
'<div class="fichecenter fichecenterbis">';
691$boxlist =
'<div class="twocolumns">';
693$boxlist .=
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
695$boxlist .= $graphcat;
696$boxlist .= $activity;
698$boxlist .= $resultboxes[
'boxlista'];
699$boxlist .=
"</div>\n";
701$boxlist .=
'<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
702$boxlist .= $lastmodified;
703$boxlist .= $latestwarehouse;
704$boxlist .= $latestmovement;
705$boxlist .= $resultboxes[
'boxlistb'];
706$boxlist .=
'</div>'.
"\n";
708$boxlist .=
"</div>\n";
714$parameters = array(
'type' => $type,
'user' => $user);
715$reshook = $hookmanager->executeHooks(
'dashboardProductsServices', $parameters, $product_static);
736 $sql =
"SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as mnttot";
737 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f, ".MAIN_DB_PREFIX.
"facturedet as fd";
738 $sql .=
" , ".MAIN_DB_PREFIX.
"paiement as p,".MAIN_DB_PREFIX.
"paiement_facture as pf";
739 $sql .=
" WHERE f.entity IN (".getEntity(
'invoice').
")";
740 $sql .=
" AND f.rowid = fd.fk_facture";
741 $sql .=
" AND pf.fk_facture = f.rowid";
742 $sql .=
" AND pf.fk_paiement = p.rowid";
743 $sql .=
" AND fd.product_type = ".((int) $product_type);
744 $sql .=
" AND p.datep >= '".$db->idate(
dol_get_first_day($yearofbegindate, 1)).
"'";
745 $sql .=
" GROUP BY annee, mois ";
746 $sql .=
" ORDER BY annee, mois ";
748 $result =
$db->query($sql);
756 $num =
$db->num_rows($result);
759 $out .=
'<div class="div-table-responsive-no-min">';
760 $out .=
'<table class="noborder" width="75%">';
762 if ($product_type == 0) {
763 $out .=
'<tr class="liste_titre"><td class=left>'.$langs->trans(
"ProductSellByQuarterHT").
'</td>';
765 $out .=
'<tr class="liste_titre"><td class=left>'.$langs->trans(
"ServiceSellByQuarterHT").
'</td>';
767 $out .=
'<td class=right>'.$langs->trans(
"Quarter1").
'</td>';
768 $out .=
'<td class=right>'.$langs->trans(
"Quarter2").
'</td>';
769 $out .=
'<td class=right>'.$langs->trans(
"Quarter3").
'</td>';
770 $out .=
'<td class=right>'.$langs->trans(
"Quarter4").
'</td>';
771 $out .=
'<td class=right>'.$langs->trans(
"Total").
'</td>';
777 $objp =
$db->fetch_object($result);
778 if ($tmpyear != $objp->annee) {
779 if ($trim1 + $trim2 + $trim3 + $trim4 > 0) {
780 $out .=
'<tr class="oddeven"><td class=left>'.$tmpyear.
'</td>';
781 $out .=
'<td class="nowrap right">'.price($trim1).
'</td>';
782 $out .=
'<td class="nowrap right">'.price($trim2).
'</td>';
783 $out .=
'<td class="nowrap right">'.price($trim3).
'</td>';
784 $out .=
'<td class="nowrap right">'.price($trim4).
'</td>';
785 $out .=
'<td class="nowrap right">'.price($trim1 + $trim2 + $trim3 + $trim4).
'</td>';
790 $tmpyear = $objp->annee;
797 if ($objp->mois ==
"01" || $objp->mois ==
"02" || $objp->mois ==
"03") {
798 $trim1 += $objp->mnttot;
801 if ($objp->mois ==
"04" || $objp->mois ==
"05" || $objp->mois ==
"06") {
802 $trim2 += $objp->mnttot;
805 if ($objp->mois ==
"07" || $objp->mois ==
"08" || $objp->mois ==
"09") {
806 $trim3 += $objp->mnttot;
809 if ($objp->mois ==
"10" || $objp->mois ==
"11" || $objp->mois ==
"12") {
810 $trim4 += $objp->mnttot;
815 if ($trim1 + $trim2 + $trim3 + $trim4 > 0) {
816 $out .=
'<tr class="oddeven"><td class=left>'.$tmpyear.
'</td>';
817 $out .=
'<td class="nowrap right">'.price($trim1).
'</td>';
818 $out .=
'<td class="nowrap right">'.price($trim2).
'</td>';
819 $out .=
'<td class="nowrap right">'.price($trim3).
'</td>';
820 $out .=
'<td class="nowrap right">'.price($trim4).
'</td>';
821 $out .=
'<td class="nowrap right">'.price($trim1 + $trim2 + $trim3 + $trim4).
'</td>';
825 $out .=
'</table></div>';
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage warehouses.
const STATUS_OPEN_ALL
Warehouse open and any operations are allowed (customer shipping, supplier dispatch,...
static saveboxorder($dbs, $zone, $boxorder, $userid=0)
Save order of boxes for area and user.
Class to manage stock movements.
Class to parse product price expressions.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class with list of lots and properties.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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...
activitytrim($product_type)
Print html activity for product type.
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
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.