32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/dashboard.lib.php';
47$hookmanager->initHooks(array(
'mrpindex'));
50$langs->loadLangs(array(
"companies",
"mrp"));
63include DOL_DOCUMENT_ROOT.
'/core/actions_addbox.inc.php';
70$staticbom =
new BOM($db);
71$staticmo =
new Mo($db);
73$title = $langs->trans(
'MRP');
74$help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
79llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-mrp page-index');
81print
load_fiche_titre($langs->trans(
"MRPArea"), $resultboxes[
'selectboxlist'],
'mrp');
84print
'<div class="fichecenter">';
86print
'<div class="twocolumns">';
88print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
96 $sql =
"SELECT COUNT(t.rowid) as nb, status";
97 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as t";
98 $sql .=
" WHERE t.entity IN (".getEntity(
'mo').
")";
99 $sql .=
" GROUP BY t.status";
100 $sql .=
" ORDER BY t.status ASC";
101 $resql = $db->query($sql);
105 while ($obj = $db->fetch_object($resql)) {
106 $vals[$obj->status] = $obj->nb;
111 $colorofstatus = array(
112 Mo::STATUS_DRAFT =>
'-'.$colors[0],
113 Mo::STATUS_VALIDATED => $colors[1],
114 Mo::STATUS_INPROGRESS => $colors[4],
115 Mo::STATUS_PRODUCED => $colors[6],
116 Mo::STATUS_CANCELED => $colors[9],
119 foreach (array(0, 1, 2, 3, 9) as $status) {
121 'label' => $staticmo->LibStatut($status, 1),
122 'labelnojs' => $staticmo->LibStatut($status, 0),
123 'nb' => (isset($vals[$status]) ? (
int) $vals[$status] : 0),
124 'color' => $colorofstatus[$status],
125 'url' =>
'mo_list.php?search_status='.$status,
128 print
getStatusPieChart($langs->trans(
"Statistics").
' - '.$langs->trans(
"ManufacturingOrder"), $series, array(
'total' =>
false));
130 dol_print_error($db);
137print $resultboxes[
'boxlista'];
139print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
147 $sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status, a.fk_product";
148 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bom_bom as a";
149 $sql .=
" WHERE a.entity IN (".getEntity(
'bom').
")";
150 $sql .= $db->order(
"a.tms",
"DESC");
151 $sql .= $db->plimit($max, 0);
153 $resql = $db->query($sql);
155 print
'<div class="div-table-responsive-no-min">';
156 print
'<table class="noborder centpercent">';
157 print
'<tr class="liste_titre">';
158 print
'<th colspan="2">'.$langs->trans(
"LatestBOMModified", $max);
159 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/bom/bom_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
160 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
161 $lastmodified .=
'</a>';
164 print
'<th class="right">';
169 $num = $db->num_rows($resql);
173 $obj = $db->fetch_object($resql);
175 $staticbom->id = $obj->rowid;
176 $staticbom->ref = $obj->ref;
177 $staticbom->fk_product = $obj->fk_product;
178 $staticbom->date_modification = $obj->datem;
179 $staticbom->status = $obj->status;
181 print
'<tr class="oddeven">';
182 print
'<td>'.$staticbom->getNomUrl(1,
'32').
'</td>';
183 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
184 print
'<td class="right">'.$staticbom->getLibStatut(3).
'</td>';
189 print
'<tr class="oddeven">';
190 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
197 dol_print_error($db);
207 $sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
208 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as a";
209 $sql .=
" WHERE a.entity IN (".getEntity(
'mo').
")";
210 $sql .= $db->order(
"a.tms",
"DESC");
211 $sql .= $db->plimit($max, 0);
213 $sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
214 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as a";
215 $sql .=
" WHERE a.entity IN (".getEntity(
'mo').
")";
216 $sql .= $db->order(
"a.tms",
"DESC");
217 $sql .= $db->plimit($max, 0);
219 $resql = $db->query($sql);
221 print
'<div class="div-table-responsive-no-min">';
222 print
'<table class="noborder centpercent">';
223 print
'<tr class="liste_titre">';
224 print
'<th colspan="2">'.$langs->trans(
"LatestMOModified", $max);
225 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/mrp/mo_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
226 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
227 $lastmodified .=
'</a>';
230 print
'<th class="right">';
235 $num = $db->num_rows($resql);
239 $obj = $db->fetch_object($resql);
241 $staticmo->id = $obj->rowid;
242 $staticmo->ref = $obj->ref;
243 $staticmo->date_modification = $obj->datem;
244 $staticmo->status = $obj->status;
246 print
'<tr class="oddeven">';
247 print
'<td>'.$staticmo->getNomUrl(1,
'32').
'</td>';
248 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
249 print
'<td class="right">'.$staticmo->getLibStatut(3).
'</td>';
254 print
'<tr class="oddeven">';
255 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
262 dol_print_error($db);
266print $resultboxes[
'boxlistb'];
268print
'</div></div></div>';
275$reshook = $hookmanager->executeHooks(
'dashboardMRP', $parameters, $object);
if(! $sortfield) if(! $sortorder) $object
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.
getThemeBadgeStatusColors()
Return the colors of status badges defined by the current theme (theme_vars.inc.php)
getStatusPieChart($title, $series, $options=array())
Return the HTML table with a pie chart of values by status, as shown on the home page of a module.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
isModEnabled($module)
Is Dolibarr module enabled.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.