32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/bom/class/bom.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
45$hookmanager->initHooks(array(
'mrpindex'));
48$langs->loadLangs(array(
"companies",
"mrp"));
60$staticbom =
new BOM($db);
61$staticmo =
new Mo($db);
63$title = $langs->trans(
'MRP');
64$help_url =
'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag';
66llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-mrp page-index');
71print
'<div class="fichecenter">';
73print
'<div class="twocolumns">';
75print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
82if (isModEnabled(
'mrp') &&
$conf->use_javascript_ajax) {
83 $sql =
"SELECT COUNT(t.rowid) as nb, status";
84 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as t";
85 $sql .=
" GROUP BY t.status";
86 $sql .=
" ORDER BY t.status ASC";
87 $resql = $db->query($sql);
90 $num = $db->num_rows($resql);
94 $dataseries = array();
95 $colorseries = array();
98 include DOL_DOCUMENT_ROOT.
'/theme/'.
$conf->theme.
'/theme_vars.inc.php';
101 $obj = $db->fetch_object($resql);
103 $vals[$obj->status] = $obj->nb;
105 $totalnb += $obj->nb;
111 print
'<div class="div-table-responsive-no-min">';
112 print
'<table class="noborder nohover centpercent">';
113 print
'<tr class="liste_titre"><th colspan="2">'.$langs->trans(
"Statistics").
' - '.$langs->trans(
"ManufacturingOrder").
'</th>';
115 $listofstatus = array(0, 1, 2, 3, 9);
116 foreach ($listofstatus as $status) {
117 $dataseries[] = array($staticmo->LibStatut($status, 1), (isset($vals[$status]) ? (
int) $vals[$status] : 0));
118 if ($status == Mo::STATUS_DRAFT) {
119 $colorseries[$status] =
'-'.$badgeStatus0;
121 if ($status == Mo::STATUS_VALIDATED) {
122 $colorseries[$status] = $badgeStatus1;
124 if ($status == Mo::STATUS_INPROGRESS) {
125 $colorseries[$status] = $badgeStatus4;
127 if ($status == Mo::STATUS_PRODUCED) {
128 $colorseries[$status] = $badgeStatus6;
130 if ($status == Mo::STATUS_CANCELED) {
131 $colorseries[$status] = $badgeStatus9;
134 if (empty(
$conf->use_javascript_ajax)) {
135 print
'<tr class="oddeven">';
136 print
'<td>'.$staticmo->LibStatut($status, 0).
'</td>';
137 print
'<td class="right"><a href="list.php?statut='.$status.
'">'.(isset($vals[$status]) ? $vals[$status] : 0).
'</a></td>';
141 if (
$conf->use_javascript_ajax) {
142 print
'<tr><td class="center" colspan="2">';
144 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
146 $dolgraph->SetData($dataseries);
147 $dolgraph->SetDataColor(array_values($colorseries));
148 $dolgraph->setShowLegend(2);
149 $dolgraph->setShowPercent(1);
150 $dolgraph->SetType(array(
'pie'));
151 $dolgraph->SetHeight(
'200');
152 $dolgraph->draw(
'idgraphstatus');
153 print $dolgraph->show($totalnb ? 0 : 1);
169print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
176if (isModEnabled(
'bom')) {
177 $sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status, a.fk_product";
178 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bom_bom as a";
179 $sql .=
" WHERE a.entity IN (".getEntity(
'bom').
")";
180 $sql .= $db->order(
"a.tms",
"DESC");
181 $sql .= $db->plimit($max, 0);
183 $resql = $db->query($sql);
185 print
'<div class="div-table-responsive-no-min">';
186 print
'<table class="noborder centpercent">';
187 print
'<tr class="liste_titre">';
188 print
'<th colspan="2">'.$langs->trans(
"LatestBOMModified", $max);
189 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/bom/bom_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
190 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
191 $lastmodified .=
'</a>';
194 print
'<th class="right">';
199 $num = $db->num_rows($resql);
203 $obj = $db->fetch_object($resql);
205 $staticbom->id = $obj->rowid;
206 $staticbom->ref = $obj->ref;
207 $staticbom->fk_product = $obj->fk_product;
208 $staticbom->date_modification = $obj->datem;
209 $staticbom->status = $obj->status;
211 print
'<tr class="oddeven">';
212 print
'<td>'.$staticbom->getNomUrl(1,
'32').
'</td>';
213 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
214 print
'<td class="right">'.$staticbom->getLibStatut(3).
'</td>';
219 print
'<tr class="oddeven">';
220 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
236if (isModEnabled(
'mrp')) {
237 $sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
238 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as a";
239 $sql .=
" WHERE a.entity IN (".getEntity(
'mo').
")";
240 $sql .= $db->order(
"a.tms",
"DESC");
241 $sql .= $db->plimit($max, 0);
243 $sql =
"SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
244 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mrp_mo as a";
245 $sql .=
" WHERE a.entity IN (".getEntity(
'mo').
")";
246 $sql .= $db->order(
"a.tms",
"DESC");
247 $sql .= $db->plimit($max, 0);
249 $resql = $db->query($sql);
251 print
'<div class="div-table-responsive-no-min">';
252 print
'<table class="noborder centpercent">';
253 print
'<tr class="liste_titre">';
254 print
'<th colspan="2">'.$langs->trans(
"LatestMOModified", $max);
255 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/mrp/mo_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
256 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
257 $lastmodified .=
'</a>';
260 print
'<th class="right">';
265 $num = $db->num_rows($resql);
269 $obj = $db->fetch_object($resql);
271 $staticmo->id = $obj->rowid;
272 $staticmo->ref = $obj->ref;
273 $staticmo->date_modification = $obj->datem;
274 $staticmo->status = $obj->status;
276 print
'<tr class="oddeven">';
277 print
'<td>'.$staticmo->getNomUrl(1,
'32').
'</td>';
278 print
'<td>'.dol_print_date($db->jdate($obj->datem),
'dayhour').
'</td>';
279 print
'<td class="right">'.$staticmo->getLibStatut(3).
'</td>';
284 print
'<tr class="oddeven">';
285 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
296print
'</div></div></div>';
303$reshook = $hookmanager->executeHooks(
'dashboardMRP', $parameters, $object);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
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.