20if (empty($conf) || !is_object($conf)) {
21 print
"Error, template page can't be called as URL";
27if (!empty($form) && !is_object($form)) {
28 $form =
new Form($db);
31$qtytoconsumeforline = $this->tpl[
'qty'] / ( !empty($this->tpl[
'efficiency']) ? $this->tpl[
'efficiency'] : 1 );
35$qtytoconsumeforline =
price2num($qtytoconsumeforline,
'MS');
38$tmpproduct->fetch($line->fk_product);
39$tmpbom =
new BOM($db);
40$res = $tmpbom->fetch($line->fk_bom_child);
44<!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->
46print
'<tr class="oddeven'.(empty($this->tpl[
'strike']) ?
'' :
' strikefordisabled').
'">';
50 print $tmpproduct->getNomUrl(1);
52 print
' ' . $langs->trans(
"or") .
' ';
53 print $tmpbom->getNomUrl(1);
54 print
' <a class="collapse_bom" id="collapse-' . $line->id .
'" href="#">';
55 print (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ?
img_picto(
'',
'folder') :
img_picto(
'',
'folder-open'));
59 print $this->tpl[
'label'];
63print
'<td class="right">'.$this->tpl[
'qty'].(($this->tpl[
'efficiency'] > 0 && $this->tpl[
'efficiency'] < 1) ?
' / '.$form->textwithpicto($this->tpl[
'efficiency'], $langs->trans(
"ValueOfMeansLoss")).
' = '.$qtytoconsumeforline :
'').
'</td>';
64print
'<td class="center">'.(empty($this->tpl[
'stock']) ? 0 :
price2num($this->tpl[
'stock'],
'MS'));
65if ($this->tpl[
'seuil_stock_alerte'] !=
'' && ($this->tpl[
'stock'] < $this->tpl[
'seuil_stock_alerte'])) {
66 print
' '.img_warning($langs->trans(
"StockLowerThanLimit", $this->tpl[
'seuil_stock_alerte']));
69print
'<td class="center">'.((empty($this->tpl[
'virtual_stock']) ? 0 :
price2num($this->tpl[
'virtual_stock'],
'MS')));
70if ($this->tpl[
'seuil_stock_alerte'] !=
'' && ($this->tpl[
'virtual_stock'] < $this->tpl[
'seuil_stock_alerte'])) {
71 print
' '.img_warning($langs->trans(
"StockLowerThanLimit", $this->tpl[
'seuil_stock_alerte']));
74print
'<td class="center">'.($this->tpl[
'qty_frozen'] ?
yn($this->tpl[
'qty_frozen']) :
'').
'</td>';
75print
'<td class="center">'.($this->tpl[
'disable_stock_change'] ?
yn($this->tpl[
'disable_stock_change']) :
'').
'</td>';
79if (!empty($selectedLines) && !in_array($this->tpl[
'id'], $selectedLines)) {
84 print
'<td class="center">';
85 print
'<input type="checkbox" name="bomlineid[]" value="' . $line->id .
'">';
88 print
'<td class="center"></td>';
98$sql =
'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.
'bom_bomline AS bl';
99$sql.=
' WHERE fk_bom ='. (int) $tmpbom->id;
100$resql = $db->query($sql);
104 while ($obj = $db->fetch_object($resql)) {
105 $sub_bom_product =
new Product($db);
106 $sub_bom_product->fetch($obj->fk_product);
107 $sub_bom_product->load_stock();
109 $sub_bom =
new BOM($db);
110 $sub_bom->fetch($obj->fk_bom_child);
112 $sub_bom_line =
new BOMLine($db);
113 $sub_bom_line->fetch($obj->rowid);
116 if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)) {
117 print
'<tr style="display:none" class="sub_bom_lines" parentid="'.$line->id.
'">';
119 print
'<tr class="sub_bom_lines" parentid="'.$line->id.
'">';
123 print
'<td style="padding-left: 5%" id="sub_bom_product_'.$sub_bom_line->id.
'">';
124 if (!empty($obj->fk_bom_child)) {
125 print $sub_bom_product->getNomUrl(1);
126 print
' '.$langs->trans(
'or').
' ';
127 print $sub_bom->getNomUrl(1);
129 print $sub_bom_product->getNomUrl(1);
134 if ($sub_bom_line->qty_frozen > 0) {
135 print
'<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.
'">'.
price($sub_bom_line->qty, 0,
'', 0, 0).
'</td>';
137 print
'<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.
'">'.
price($sub_bom_line->qty * $line->qty, 0,
'', 0, 0).
'</td>';
141 if ($sub_bom_product->stock_reel > 0) {
142 print
'<td class="linecolstockreel nowrap center" id="sub_bom_stock_reel_'.$sub_bom_product->stock_reel.
'">'.$sub_bom_product->stock_reel.
'</td>';
144 print
'<td class="linecolstockreel nowrap center" id="sub_bom_stock_reel_'.$sub_bom_product->stock_reel.
'"> </td>';
148 if ($sub_bom_product->stock_theorique > 0) {
149 print
'<td class="linecolstocktheorique nowrap center" id="sub_bom_stock_theorique_'.$sub_bom_product->stock_theorique.
'">'.$sub_bom_product->stock_theorique.
'</td>';
151 print
'<td class="linecolstocktheorique nowrap center" id="sub_bom_stock_theorique_'.$sub_bom_product->stock_theorique.
'"> </td>';
155 if ($sub_bom_line->qty_frozen > 0) {
156 print
'<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->qty_frozen.
'">'.$langs->trans(
'Yes').
'</td>';
158 print
'<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->qty_frozen.
'"> </td>';
162 if ($sub_bom_line->disable_stock_change > 0) {
163 print
'<td class="linecoldisablestockchange nowrap right" id="sub_bom_stock_change_'.$sub_bom_line->id.
'">'.
yn($sub_bom_line->disable_stock_change).
'</td>';
165 print
'<td class="linecoldisablestockchange nowrap right" id="sub_bom_stock_change_'.$sub_bom_line->id.
'"> </td>';
174<!-- END PHP TEMPLATE originproductline.tpl.php -->
Class to manage products or services.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)