30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
37$hookmanager->initHooks(array(
'mrpindex'));
40$langs->loadLangs(array(
"companies",
"mrp"));
52$staticbom =
new BOM($db);
53$staticmo =
new Mo($db);
60print
'<div class="fichecenter">';
62print
'<div class="twocolumns">';
64print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
71if ($conf->use_javascript_ajax) {
72 $sql =
"SELECT COUNT(t.rowid) as nb, status";
73 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as t";
74 $sql .=
" GROUP BY t.status";
75 $sql .=
" ORDER BY t.status ASC";
76 $resql = $db->query($sql);
79 $num = $db->num_rows($resql);
83 $dataseries = array();
84 $colorseries = array();
87 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
90 $obj = $db->fetch_object($resql);
92 $vals[$obj->status] = $obj->nb;
100 print
'<div class="div-table-responsive-no-min">';
101 print
'<table class="noborder nohover centpercent">';
102 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"ManufacturingOrder").
'</th>';
104 $listofstatus = array(0, 1, 2, 3, 9);
105 foreach ($listofstatus as $status) {
106 $dataseries[] = array($staticmo->LibStatut($status, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
107 if ($status == Mo::STATUS_DRAFT) {
108 $colorseries[$status] =
'-'.$badgeStatus0;
110 if ($status == Mo::STATUS_VALIDATED) {
111 $colorseries[$status] = $badgeStatus1;
113 if ($status == Mo::STATUS_INPROGRESS) {
114 $colorseries[$status] = $badgeStatus4;
116 if ($status == Mo::STATUS_PRODUCED) {
117 $colorseries[$status] = $badgeStatus6;
119 if ($status == Mo::STATUS_CANCELED) {
120 $colorseries[$status] = $badgeStatus9;
123 if (empty($conf->use_javascript_ajax)) {
124 print
'<tr class="oddeven">';
125 print
'<td>'.$staticmo->LibStatut($status, 0).
'</td>';
126 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
130 if ($conf->use_javascript_ajax) {
131 print
'<tr><td class="center" colspan="2">';
133 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
135 $dolgraph->SetData($dataseries);
136 $dolgraph->SetDataColor(array_values($colorseries));
137 $dolgraph->setShowLegend(2);
138 $dolgraph->setShowPercent(1);
139 $dolgraph->SetType(array(
'pie'));
140 $dolgraph->SetHeight(
'200');
141 $dolgraph->draw(
'idgraphstatus');
142 print $dolgraph->show($totalnb ? 0 : 1);
158print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
165$sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status, a.fk_product";
166$sql .=
" FROM ".MAIN_DB_PREFIX.
"bom_bom as a";
167$sql .=
" WHERE a.entity IN (".getEntity(
'bom').
")";
168$sql .= $db->order(
"a.tms",
"DESC");
169$sql .= $db->plimit($max, 0);
171$resql = $db->query($sql);
173 print
'<div class="div-table-responsive-no-min">';
174 print
'<table class="noborder centpercent">';
175 print
'<tr class="liste_titre">';
176 print
'<th colspan="2">'.$langs->trans(
"LatestBOMModified", $max);
177 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/bom/bom_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
178 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
179 $lastmodified .=
'</a>';
182 print
'<th class="right">';
187 $num = $db->num_rows($resql);
191 $obj = $db->fetch_object($resql);
193 $staticbom->id = $obj->rowid;
194 $staticbom->ref = $obj->ref;
195 $staticbom->fk_product = $obj->fk_product;
196 $staticbom->date_modification = $obj->datem;
197 $staticbom->status = $obj->status;
199 print
'<tr class="oddeven">';
200 print
'<td>'.$staticbom->getNomUrl(1, 32).
'</td>';
201 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
202 print
'<td class="right">'.$staticbom->getLibStatut(3).
'</td>';
207 print
'<tr class="oddeven">';
208 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
211 print
"</table></div>";
222$sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
223$sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as a";
224$sql .=
" WHERE a.entity IN (".getEntity(
'mo').
")";
225$sql .= $db->order(
"a.tms",
"DESC");
226$sql .= $db->plimit($max, 0);
228$resql = $db->query($sql);
230 print
'<div class="div-table-responsive-no-min">';
231 print
'<table class="noborder centpercent">';
232 print
'<tr class="liste_titre">';
233 print
'<th colspan="2">'.$langs->trans(
"LatestMOModified", $max);
234 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/mrp/mo_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
235 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
236 $lastmodified .=
'</a>';
239 print
'<th class="right">';
244 $num = $db->num_rows($resql);
248 $obj = $db->fetch_object($resql);
250 $staticmo->id = $obj->rowid;
251 $staticmo->ref = $obj->ref;
252 $staticmo->date_modification = $obj->datem;
253 $staticmo->status = $obj->status;
255 print
'<tr class="oddeven">';
256 print
'<td>'.$staticmo->getNomUrl(1, 32).
'</td>';
257 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
258 print
'<td class="right">'.$staticmo->getLibStatut(3).
'</td>';
263 print
'<tr class="oddeven">';
264 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
267 print
"</table></div>";
273print
'</div></div></div>';
280$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()
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.