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"));
50$staticbom =
new BOM($db);
51$staticmo =
new Mo($db);
58print
'<div class="fichecenter"><div class="fichethirdleft">';
65if ($conf->use_javascript_ajax) {
66 $sql =
"SELECT COUNT(t.rowid) as nb, status";
67 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as t";
68 $sql .=
" GROUP BY t.status";
69 $sql .=
" ORDER BY t.status ASC";
70 $resql = $db->query($sql);
73 $num = $db->num_rows($resql);
77 $dataseries = array();
78 $colorseries = array();
81 include DOL_DOCUMENT_ROOT.
'/theme/'.$conf->theme.
'/theme_vars.inc.php';
84 $obj = $db->fetch_object($resql);
86 $vals[$obj->status] = $obj->nb;
94 print
'<div class="div-table-responsive-no-min">';
95 print
'<table class="noborder nohover centpercent">';
96 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"ManufacturingOrder").
'</th></tr>'.
"\n";
97 $listofstatus = array(0, 1, 2, 3, 9);
98 foreach ($listofstatus as $status) {
99 $dataseries[] = array($staticmo->LibStatut($status, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
100 if ($status == Mo::STATUS_DRAFT) {
101 $colorseries[$status] =
'-'.$badgeStatus0;
103 if ($status == Mo::STATUS_VALIDATED) {
104 $colorseries[$status] = $badgeStatus1;
106 if ($status == Mo::STATUS_INPROGRESS) {
107 $colorseries[$status] = $badgeStatus4;
109 if ($status == Mo::STATUS_PRODUCED) {
110 $colorseries[$status] = $badgeStatus6;
112 if ($status == Mo::STATUS_CANCELED) {
113 $colorseries[$status] = $badgeStatus9;
116 if (empty($conf->use_javascript_ajax)) {
117 print
'<tr class="oddeven">';
118 print
'<td>'.$staticmo->LibStatut($status, 0).
'</td>';
119 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
123 if ($conf->use_javascript_ajax) {
124 print
'<tr><td class="center" colspan="2">';
126 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
128 $dolgraph->SetData($dataseries);
129 $dolgraph->SetDataColor(array_values($colorseries));
130 $dolgraph->setShowLegend(2);
131 $dolgraph->setShowPercent(1);
132 $dolgraph->SetType(array(
'pie'));
133 $dolgraph->SetHeight(
'200');
134 $dolgraph->draw(
'idgraphstatus');
135 print $dolgraph->show($totalnb ? 0 : 1);
151print
'</div><div class="fichetwothirdright">';
159$sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status, a.fk_product";
160$sql .=
" FROM ".MAIN_DB_PREFIX.
"bom_bom as a";
161$sql .=
" WHERE a.entity IN (".getEntity(
'bom').
")";
162$sql .= $db->order(
"a.tms",
"DESC");
163$sql .= $db->plimit($max, 0);
165$resql = $db->query($sql);
167 print
'<div class="div-table-responsive-no-min">';
168 print
'<table class="noborder centpercent">';
169 print
'<tr class="liste_titre">';
170 print
'<th colspan="4">'.$langs->trans(
"LatestBOMModified", $max).
'</th></tr>';
172 $num = $db->num_rows($resql);
176 $obj = $db->fetch_object($resql);
178 $staticbom->id = $obj->rowid;
179 $staticbom->ref = $obj->ref;
180 $staticbom->fk_product = $obj->fk_product;
181 $staticbom->date_modification = $obj->datem;
182 $staticbom->status = $obj->status;
184 print
'<tr class="oddeven">';
185 print
'<td>'.$staticbom->getNomUrl(1, 32).
'</td>';
186 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
187 print
'<td class="right">'.$staticbom->getLibStatut(3).
'</td>';
192 print
'<tr class="oddeven">';
193 print
'<td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
196 print
"</table></div>";
208$sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
209$sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as a";
210$sql .=
" WHERE a.entity IN (".getEntity(
'mo').
")";
211$sql .= $db->order(
"a.tms",
"DESC");
212$sql .= $db->plimit($max, 0);
214$resql = $db->query($sql);
216 print
'<div class="div-table-responsive-no-min">';
217 print
'<table class="noborder centpercent">';
218 print
'<tr class="liste_titre">';
219 print
'<th colspan="4">'.$langs->trans(
"LatestMOModified", $max).
'</th></tr>';
221 $num = $db->num_rows($resql);
225 $obj = $db->fetch_object($resql);
227 $staticmo->id = $obj->rowid;
228 $staticmo->ref = $obj->ref;
229 $staticmo->date_modification = $obj->datem;
230 $staticmo->status = $obj->status;
232 print
'<tr class="oddeven">';
233 print
'<td>'.$staticmo->getNomUrl(1, 32).
'</td>';
234 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
235 print
'<td class="right">'.$staticmo->getLibStatut(3).
'</td>';
240 print
'<tr class="oddeven">';
241 print
'<td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
244 print
"</table></div>";
257$reshook = $hookmanager->executeHooks(
'dashboardMRP', $parameters, $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($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db='', $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.