31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
38$hookmanager->initHooks(array(
'mrpindex'));
41$langs->loadLangs(array(
"companies",
"mrp"));
53$staticbom =
new BOM($db);
54$staticmo =
new Mo($db);
56$title = $langs->trans(
'MRP');
57$help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
59llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-mrp page-index');
64print
'<div class="fichecenter">';
66print
'<div class="twocolumns">';
68print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
75if ($conf->use_javascript_ajax) {
76 $sql =
"SELECT COUNT(t.rowid) as nb, status";
77 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as t";
78 $sql .=
" GROUP BY t.status";
79 $sql .=
" ORDER BY t.status ASC";
80 $resql = $db->query($sql);
83 $num = $db->num_rows($resql);
87 $dataseries = array();
88 $colorseries = array();
91 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
94 $obj = $db->fetch_object($resql);
96 $vals[$obj->status] = $obj->nb;
104 print
'<div class="div-table-responsive-no-min">';
105 print
'<table class="noborder nohover centpercent">';
106 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"ManufacturingOrder").
'</th>';
108 $listofstatus = array(0, 1, 2, 3, 9);
109 foreach ($listofstatus as $status) {
110 $dataseries[] = array($staticmo->LibStatut($status, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
111 if ($status == Mo::STATUS_DRAFT) {
112 $colorseries[$status] =
'-'.$badgeStatus0;
114 if ($status == Mo::STATUS_VALIDATED) {
115 $colorseries[$status] = $badgeStatus1;
117 if ($status == Mo::STATUS_INPROGRESS) {
118 $colorseries[$status] = $badgeStatus4;
120 if ($status == Mo::STATUS_PRODUCED) {
121 $colorseries[$status] = $badgeStatus6;
123 if ($status == Mo::STATUS_CANCELED) {
124 $colorseries[$status] = $badgeStatus9;
127 if (empty($conf->use_javascript_ajax)) {
128 print
'<tr class="oddeven">';
129 print
'<td>'.$staticmo->LibStatut($status, 0).
'</td>';
130 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
134 if ($conf->use_javascript_ajax) {
135 print
'<tr><td class="center" colspan="2">';
137 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
139 $dolgraph->SetData($dataseries);
140 $dolgraph->SetDataColor(array_values($colorseries));
141 $dolgraph->setShowLegend(2);
142 $dolgraph->setShowPercent(1);
143 $dolgraph->SetType(array(
'pie'));
144 $dolgraph->SetHeight(
'200');
145 $dolgraph->draw(
'idgraphstatus');
146 print $dolgraph->show($totalnb ? 0 : 1);
162print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
169$sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status, a.fk_product";
170$sql .=
" FROM ".MAIN_DB_PREFIX.
"bom_bom as a";
171$sql .=
" WHERE a.entity IN (".getEntity(
'bom').
")";
172$sql .= $db->order(
"a.tms",
"DESC");
173$sql .= $db->plimit($max, 0);
175$resql = $db->query($sql);
177 print
'<div class="div-table-responsive-no-min">';
178 print
'<table class="noborder centpercent">';
179 print
'<tr class="liste_titre">';
180 print
'<th colspan="2">'.$langs->trans(
"LatestBOMModified", $max);
181 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/bom/bom_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
182 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
183 $lastmodified .=
'</a>';
186 print
'<th class="right">';
191 $num = $db->num_rows($resql);
195 $obj = $db->fetch_object($resql);
197 $staticbom->id = $obj->rowid;
198 $staticbom->ref = $obj->ref;
199 $staticbom->fk_product = $obj->fk_product;
200 $staticbom->date_modification = $obj->datem;
201 $staticbom->status = $obj->status;
203 print
'<tr class="oddeven">';
204 print
'<td>'.$staticbom->getNomUrl(1, 32).
'</td>';
205 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
206 print
'<td class="right">'.$staticbom->getLibStatut(3).
'</td>';
211 print
'<tr class="oddeven">';
212 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
215 print
"</table></div>";
226$sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
227$sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as a";
228$sql .=
" WHERE a.entity IN (".getEntity(
'mo').
")";
229$sql .= $db->order(
"a.tms",
"DESC");
230$sql .= $db->plimit($max, 0);
232$resql = $db->query($sql);
234 print
'<div class="div-table-responsive-no-min">';
235 print
'<table class="noborder centpercent">';
236 print
'<tr class="liste_titre">';
237 print
'<th colspan="2">'.$langs->trans(
"LatestMOModified", $max);
238 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/mrp/mo_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
239 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
240 $lastmodified .=
'</a>';
243 print
'<th class="right">';
248 $num = $db->num_rows($resql);
252 $obj = $db->fetch_object($resql);
254 $staticmo->id = $obj->rowid;
255 $staticmo->ref = $obj->ref;
256 $staticmo->date_modification = $obj->datem;
257 $staticmo->status = $obj->status;
259 print
'<tr class="oddeven">';
260 print
'<td>'.$staticmo->getNomUrl(1, 32).
'</td>';
261 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
262 print
'<td class="right">'.$staticmo->getLibStatut(3).
'</td>';
267 print
'<tr class="oddeven">';
268 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
271 print
"</table></div>";
277print
'</div></div></div>';
284$reshook = $hookmanager->executeHooks(
'dashboardMRP', $parameters, $object);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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...
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.