{strip}
{if $showShortages} {biticon ipackage="icons" iname="text-csv" iexplain="Download CSV"} {if $gBitUser->hasPermission('p_stock_create')} {biticon ipackage="icons" iname="view-task-add" iexplain="Create Order"} {/if} {/if}
{if $filterUserId}{/if}
{if $showBom}
{/if}
{if $showBom && $gBitUser->hasPermission('p_stock_create')} {tr}Create Prebuild{/tr} {/if}

{tr}Stock Levels{/tr}{if $assemblyTitle} — {$assemblyTitle|escape}{/if}

{tr}Stock Levels{/tr} {if $filterUserName}› {$filterUserName|escape}{/if}
{if $stockList} {if $showBom}{/if} {if $showBom}{/if} {assign var=lastBomGroup value=-1} {foreach from=$stockList item=comp} {if $showBom && !$showShortages && $comp.bom_group !== $lastBomGroup} {assign var=lastBomGroup value=$comp.bom_group} {/if} {foreach from=$comp.stock key=qtype item=row name=stockRow} {if $showBom}{assign var=remaining value=$row.level-($row.bom_qty*$kitCount)}{/if} {if $smarty.foreach.stockRow.first} {/if} {if $showBom}{/if} {if $showBom} {/if} {/foreach} {/foreach}
{tr}Component{/tr} {tr}Description{/tr} {tr}Part No.{/tr}{tr}BOM Qty{/tr}{tr}Type{/tr} {tr}Stock{/tr}{tr}Remaining{/tr}
{tr}Group{/tr} {$comp.bom_group}
{$comp.title|escape} {$comp.data|escape} {$comp.part_number|escape}{if $qtype eq 'PRT' && $row.part_size > 0}{math equation="b*k/p" b=$row.bom_qty k=$kitCount p=$row.part_size format="%.2f"}{elseif $qtype eq 'SHT'}{math equation="b*k" b=$row.bom_qty k=$kitCount format="%.2f"}{else}{math equation="b*k" b=$row.bom_qty k=$kitCount format="%.0f"}{/if}{$qtype|escape} {if $qtype eq 'PRT' && $row.part_size > 0}{math equation="l/p" l=$row.level p=$row.part_size format="%.2f"}{elseif $qtype eq 'SHT'}{$row.level|string_format:"%.2f"}{else}{$row.level|string_format:"%.0f"}{/if}{if $qtype eq 'PRT' && $row.part_size > 0}{math equation="r/p" r=$remaining p=$row.part_size format="%.2f"}{elseif $qtype eq 'SHT'}{$remaining|string_format:"%.2f"}{else}{$remaining|string_format:"%.0f"}{/if}
{else}

{tr}No stock records found.{/tr}

{/if}
{/strip}