31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
44$hookmanager->initHooks(array(
'mrpindex'));
47$langs->loadLangs(array(
"companies",
"mrp"));
59$staticbom =
new BOM($db);
60$staticmo =
new Mo($db);
62$title = $langs->trans(
'MRP');
63$help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
65llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-mrp page-index');
70print
'<div class="fichecenter">';
72print
'<div class="twocolumns">';
74print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
81if (
$conf->use_javascript_ajax) {
82 $sql =
"SELECT COUNT(t.rowid) as nb, status";
83 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as t";
84 $sql .=
" GROUP BY t.status";
85 $sql .=
" ORDER BY t.status ASC";
86 $resql = $db->query($sql);
89 $num = $db->num_rows($resql);
93 $dataseries = array();
94 $colorseries = array();
97 include DOL_DOCUMENT_ROOT.
'/theme/'.
$conf->theme.
'/theme_vars.inc.php';
100 $obj = $db->fetch_object($resql);
102 $vals[$obj->status] = $obj->nb;
104 $totalnb += $obj->nb;
110 print
'<div class="div-table-responsive-no-min">';
111 print
'<table class="noborder nohover centpercent">';
112 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"ManufacturingOrder").
'</th>';
114 $listofstatus = array(0, 1, 2, 3, 9);
115 foreach ($listofstatus as $status) {
116 $dataseries[] = array($staticmo->LibStatut($status, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
117 if ($status == Mo::STATUS_DRAFT) {
118 $colorseries[$status] =
'-'.$badgeStatus0;
120 if ($status == Mo::STATUS_VALIDATED) {
121 $colorseries[$status] = $badgeStatus1;
123 if ($status == Mo::STATUS_INPROGRESS) {
124 $colorseries[$status] = $badgeStatus4;
126 if ($status == Mo::STATUS_PRODUCED) {
127 $colorseries[$status] = $badgeStatus6;
129 if ($status == Mo::STATUS_CANCELED) {
130 $colorseries[$status] = $badgeStatus9;
133 if (empty(
$conf->use_javascript_ajax)) {
134 print
'<tr class="oddeven">';
135 print
'<td>'.$staticmo->LibStatut($status, 0).
'</td>';
136 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
140 if (
$conf->use_javascript_ajax) {
141 print
'<tr><td class="center" colspan="2">';
143 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
145 $dolgraph->SetData($dataseries);
146 $dolgraph->SetDataColor(array_values($colorseries));
147 $dolgraph->setShowLegend(2);
148 $dolgraph->setShowPercent(1);
149 $dolgraph->SetType(array(
'pie'));
150 $dolgraph->SetHeight(
'200');
151 $dolgraph->draw(
'idgraphstatus');
152 print $dolgraph->show($totalnb ? 0 : 1);
168print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
175$sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status, a.fk_product";
176$sql .=
" FROM ".MAIN_DB_PREFIX.
"bom_bom as a";
177$sql .=
" WHERE a.entity IN (".getEntity(
'bom').
")";
178$sql .= $db->order(
"a.tms",
"DESC");
179$sql .= $db->plimit($max, 0);
181$resql = $db->query($sql);
183 print
'<div class="div-table-responsive-no-min">';
184 print
'<table class="noborder centpercent">';
185 print
'<tr class="liste_titre">';
186 print
'<th colspan="2">'.$langs->trans(
"LatestBOMModified", $max);
187 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/bom/bom_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
188 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
189 $lastmodified .=
'</a>';
192 print
'<th class="right">';
197 $num = $db->num_rows($resql);
201 $obj = $db->fetch_object($resql);
203 $staticbom->id = $obj->rowid;
204 $staticbom->ref = $obj->ref;
205 $staticbom->fk_product = $obj->fk_product;
206 $staticbom->date_modification = $obj->datem;
207 $staticbom->status = $obj->status;
209 print
'<tr class="oddeven">';
210 print
'<td>'.$staticbom->getNomUrl(1, 32).
'</td>';
211 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
212 print
'<td class="right">'.$staticbom->getLibStatut(3).
'</td>';
217 print
'<tr class="oddeven">';
218 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
221 print
"</table></div>";
232$sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
233$sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as a";
234$sql .=
" WHERE a.entity IN (".getEntity(
'mo').
")";
235$sql .= $db->order(
"a.tms",
"DESC");
236$sql .= $db->plimit($max, 0);
238$resql = $db->query($sql);
240 print
'<div class="div-table-responsive-no-min">';
241 print
'<table class="noborder centpercent">';
242 print
'<tr class="liste_titre">';
243 print
'<th colspan="2">'.$langs->trans(
"LatestMOModified", $max);
244 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/mrp/mo_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
245 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
246 $lastmodified .=
'</a>';
249 print
'<th class="right">';
254 $num = $db->num_rows($resql);
258 $obj = $db->fetch_object($resql);
260 $staticmo->id = $obj->rowid;
261 $staticmo->ref = $obj->ref;
262 $staticmo->date_modification = $obj->datem;
263 $staticmo->status = $obj->status;
265 print
'<tr class="oddeven">';
266 print
'<td>'.$staticmo->getNomUrl(1, 32).
'</td>';
267 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
268 print
'<td class="right">'.$staticmo->getLibStatut(3).
'</td>';
273 print
'<tr class="oddeven">';
274 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
277 print
"</table></div>";
283print
'</div></div></div>';
290$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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.