42'@phan-var-force CommonObjectLine $line
43 @phan-var-force int $num
44 @phan-var-force CommonObject $this
45 @phan-var-force CommonObject $object';
47require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
51 print
"Error, template page can't be called as URL";
57if (empty($filtertype)) {
62global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax, $langs;
64if (empty($dateSelector)) {
67if (empty($forceall)) {
70if (empty($senderissupplier)) {
71 $senderissupplier = 0;
73if (empty($inputalsopricewithtax)) {
74 $inputalsopricewithtax = 0;
76if (empty($outputalsopricetotalwithtax)) {
77 $outputalsopricetotalwithtax = 0;
81if ($filtertype == 1) {
82 $domData =
' data-element="'.$line->element.
'service"';
84 $domData =
' data-element="'.$line->element.
'"';
87$domData .=
' data-id="'.$line->id.
'"';
88$domData .=
' data-qty="'.$line->qty.
'"';
89$domData .=
' data-product_type="'.$line->product_type.
'"';
95print
"<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->\n";
96print
'<tr id="row-'.$line->id.
'" class="drag drop oddeven" '.$domData.
' >';
100 print
'<td class="linecolnum center">'.($i + 1).
'</td>';
105print
'<td class="linecoldescription bomline minwidth300imp">';
106print
'<div id="line_'.$line->id.
'"></div>';
109$tmpproduct->fetch($line->fk_product);
111$res = $tmpbom->fetch($line->fk_bom_child);
112if ($tmpbom->id > 0) {
113 print $tmpproduct->getNomUrl(1);
114 print
' '.$langs->trans(
"or").
' ';
115 print $tmpbom->getNomUrl(1);
116 print
' <a class="collapse_bom" id="collapse-'.$line->id.
'" href="#">';
120 print $tmpproduct->getNomUrl(1);
121 print
' - '.$tmpproduct->label;
125if (!empty($extrafields)) {
126 $temps = $line->showOptionals($extrafields,
'view', array(),
'',
'', 1,
'line');
127 if (!empty($temps)) {
128 print
'<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.
'" name="extrafield_lines_area_'.$line->id.
'">';
137print
'<td class="linecolqty nowrap right">';
139echo
price($line->qty, 0,
'', 0, 0);
142if ($filtertype != 1) {
144 print
'<td class="linecoluseunit nowrap">';
147 print $langs->trans($label);
152 print
'<td class="linecolqtyfrozen nowrap right">';
154 echo $line->qty_frozen ?
yn($line->qty_frozen) :
'';
156 print
'<td class="linecoldisablestockchange nowrap right">';
158 echo $line->disable_stock_change ?
yn($line->disable_stock_change) :
'';
161 print
'<td class="linecolefficiency nowrap right">';
163 echo $line->efficiency;
167 print
'<td class="linecolunit nowrap">';
170 if (!empty($line->fk_unit)) {
171 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
172 $unit =
new CUnits($this->db);
173 $unit->fetch($line->fk_unit);
174 print(isset($unit->label) ?
" ".$langs->trans(ucwords($unit->label)).
" " :
'');
180 if (isModEnabled(
'workstation')) {
182 $res = $workstation->fetch($line->fk_default_workstation);
184 print
'<td class="linecolworkstation nowrap">';
187 echo $workstation->getNomUrl(1);
195$tmpbom->calculateCosts();
196print
'<td id="costline_'.$line->id.
'" class="linecolcost nowrap right">';
198if (!empty($line->fk_bom_child)) {
199 echo
'<span class="amount">'.price($tmpbom->total_cost * (
float) $line->qty).
'</span>';
201 echo
'<span class="amount">'.price($line->total_cost).
'</span>';
205if ($this->
status == 0 && ($object_rights->write) && $action !=
'selectlines') {
206 print
'<td class="linecoledit center">';
208 if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
210 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$this->
id.
'&action=editline&token='.
newToken().
'&lineid='.$line->id.
'">'.
img_edit().
'</a>';
214 print
'<td class="linecoldelete center">';
216 if (($line->fk_prev_id ==
null) && empty($disableremove)) {
218 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$this->
id.
'&action=deleteline&token='.
newToken().
'&lineid='.$line->id.
'">';
224 if ($num > 1 && $conf->browser->layout !=
'phone' && empty($disablemove)) {
225 print
'<td class="linecolmove tdlineupdown center">';
228 print
'<a class="lineupdown" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$this->
id.
'&action=up&token='.
newToken().
'&rowid='.$line->id.
'">';
229 echo
img_up(
'default', 0,
'imgupforline');
233 print
'<a class="lineupdown" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$this->
id.
'&action=down&token='.
newToken().
'&rowid='.$line->id.
'">';
234 echo
img_down(
'default', 0,
'imgdownforline');
239 print
'<td '.(($conf->browser->layout !=
'phone' && empty($disablemove)) ?
' class="linecolmove tdlineupdown center"' :
' class="linecolmove center"').
'></td>';
243 print
'<td colspan="3"></td>';
244 $coldisplay = $coldisplay + 3;
247if ($action ==
'selectlines') {
248 print
'<td class="linecolcheck center">';
249 print
'<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i + 1).
']" value="'.$line->id.
'" >';
257$sql =
'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.
'bom_bomline AS bl';
258$sql .=
' WHERE fk_bom ='. (int) $tmpbom->id;
259$resql =
$object->db->query($sql);
263 while ($obj =
$object->db->fetch_object($resql)) {
265 $sub_bom_product->fetch($obj->fk_product);
268 if (!empty($obj->fk_bom_child)) {
269 $sub_bom->fetch($obj->fk_bom_child);
273 $sub_bom_line->fetch($obj->rowid);
277 print
'<tr style="display:none" class="sub_bom_lines" parentid="'.$line->id.
'">';
279 print
'<tr class="sub_bom_lines" parentid="'.$line->id.
'">';
283 print
'<td style="padding-left: 5%" id="sub_bom_product_'.$sub_bom_line->id.
'">';
284 if (!empty($obj->fk_bom_child)) {
285 print $sub_bom_product->getNomUrl(1);
286 print
' '.$langs->trans(
'or').
' ';
287 print $sub_bom->getNomUrl(1);
289 print $sub_bom_product->getNomUrl(1);
294 $label = $sub_bom_product->getLabelOfUnit(
'long');
295 if ($sub_bom_line->qty_frozen > 0) {
296 print
'<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.
'">'.
price($sub_bom_line->qty, 0,
'', 0, 0).
'</td>';
298 print
'<td class="linecoluseunit nowrap left">';
300 print $langs->trans($label);
304 print
'<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.
'">'.$langs->trans(
'Yes').
'</td>';
306 print
'<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.
'">'.
price($sub_bom_line->qty * (
float) $line->qty, 0,
'', 0, 0).
'</td>';
308 print
'<td class="linecoluseunit nowrap left">';
310 print $langs->trans($label);
315 print
'<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.
'"> </td>';
319 if ($sub_bom_line->disable_stock_change > 0) {
320 print
'<td class="linecoldisablestockchange nowrap right" id="sub_bom_stock_change_'.$sub_bom_line->id.
'">'.$sub_bom_line->disable_stock_change.
'</td>';
322 print
'<td class="linecoldisablestockchange nowrap right" id="sub_bom_stock_change_'.$sub_bom_line->id.
'"> </td>';
326 print
'<td class="linecolefficiency nowrap right" id="sub_bom_efficiency_'.$sub_bom_line->id.
'">'.$sub_bom_line->efficiency.
'</td>';
329 if (!empty($sub_bom->id)) {
330 $sub_bom->calculateCosts();
331 print
'<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.
'"><span class="amount">'.
price(
price2num($sub_bom->total_cost * $sub_bom_line->qty * (
float) $line->qty,
'MT')).
'</span></td>';
332 $total_cost += $sub_bom->total_cost * $sub_bom_line->qty * (float) $line->qty;
333 } elseif ($sub_bom_product->type ==
Product::TYPE_SERVICE && isModEnabled(
'workstation') && !empty($sub_bom_product->fk_default_workstation)) {
338 $res = $workstation->fetch($sub_bom_product->fk_default_workstation);
340 $sub_bom_line->total_cost = (float)
price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated),
'MT');
343 print
'<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.
'"><span class="amount">'.
price(
price2num($sub_bom_line->total_cost,
'MT')).
'</span></td>';
344 $this->total_cost += $line->total_cost;
345 } elseif ($sub_bom_product->cost_price > 0) {
346 print
'<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.
'">';
347 print
'<span class="amount">'.price(
price2num($sub_bom_product->cost_price * $sub_bom_line->qty * (
float) $line->qty,
'MT')).
'</span></td>';
348 $total_cost += $sub_bom_product->cost_price * $sub_bom_line->qty * (float) $line->qty;
349 } elseif ($sub_bom_product->pmp > 0) {
350 print
'<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.
'">';
351 print
'<span class="amount">'.price(
price2num($sub_bom_product->pmp * $sub_bom_line->qty * (
float) $line->qty,
'MT')).
'</span></td>';
352 $total_cost .= $sub_bom_product->pmp * $sub_bom_line->qty * (float) $line->qty;
354 $sql_supplier_price =
"SELECT MIN(price) AS min_price, quantity AS qty FROM ".MAIN_DB_PREFIX.
"product_fournisseur_price";
355 $sql_supplier_price .=
" WHERE fk_product = ". (int) $sub_bom_product->id;
356 $sql_supplier_price .=
" GROUP BY quantity ORDER BY quantity ASC";
357 $resql_supplier_price =
$object->db->query($sql_supplier_price);
358 if ($resql_supplier_price) {
359 $obj =
$object->db->fetch_object($resql_supplier_price);
360 if (!empty($obj->qty) && !empty($sub_bom_line->qty) && !empty($line->qty)) {
361 $line_cost = $obj->min_price / $obj->qty * $sub_bom_line->qty * (float) $line->qty;
363 $line_cost = $obj->min_price;
365 print
'<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.
'"><span class="amount">'.
price2num($line_cost,
'MT').
'</span></td>';
366 $total_cost += $line_cost;
377print
"<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Class of dictionary type of thirdparty (used by imports)
Class to manage products or services.
const TYPE_SERVICE
Service.
convertDurationtoHour($duration_value, $duration_unit)
Convert duration to hour.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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 '.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
measuringUnitString($unit, $measuring_style='', $scale='', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.