blob: 0afba5e9c42b77ec39e6098aed3194839079fcde (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
{strip}
<div class="listing stock">
<header>
<h1>{tr}Stock Levels{/tr}{if $assemblyTitle} — {$assemblyTitle|escape}{/if}</h1>
</header>
<section class="body">
{form ipackage="stock" ifile="list_stock.php" method="get"}
<div class="form-inline" style="margin-bottom:1em">
<div class="form-group">
<select name="assembly_content_id" class="form-control input-sm">
<option value="">{tr}All components{/tr}</option>
{foreach from=$assemblyList item=asm}
<option value="{$asm.content_id|escape}"
{if $assemblyContentId == $asm.content_id} selected="selected"{/if}>
{$asm.title|escape}
</option>
{/foreach}
</select>
</div>
<div class="form-group">
<input type="text" class="form-control input-sm" name="find"
placeholder="{tr}component name...{/tr}"
value="{$find|escape}" />
</div>
{if $showBom}
<div class="form-group">
<label>{tr}Kits{/tr}</label>
<input type="number" class="form-control input-sm" name="kit_count"
min="1" step="1" style="width:5em"
value="{$kitCount|escape}" />
</div>
{/if}
<div class="form-group">
<label class="checkbox-inline">
<input type="checkbox" name="show_zero" value="1"
{if $showZero} checked="checked"{/if} /> {tr}Show zero stock{/tr}
</label>
</div>
<button type="submit" class="btn btn-default btn-sm">{tr}Go{/tr}</button>
{if $showBom && $gBitUser->hasPermission('p_stock_create')}
<a class="btn btn-warning btn-sm"
href="{$smarty.const.STOCK_PKG_URL}add_requisition.php?assembly_content_id={$assemblyContentId}&kit_count={$kitCount}">{tr}Create Requisition{/tr}</a>
{/if}
</div>
{/form}
{if $stockList}
<table class="table table-hover table-condensed">
<thead>
<tr>
<th>{tr}Component{/tr}</th>
<th>{tr}Description{/tr}</th>
<th>{tr}Part No.{/tr}</th>
{if $showBom}<th class="text-right">{tr}BOM Qty{/tr}</th>{/if}
<th>{tr}Type{/tr}</th>
<th class="text-right">{tr}Stock{/tr}</th>
{if $showBom}<th class="text-right">{tr}Remaining{/tr}</th>{/if}
</tr>
</thead>
<tbody>
{assign var=lastBomGroup value=-1}
{foreach from=$stockList item=comp}
{if $showBom && $comp.bom_group !== $lastBomGroup}
<tr class="active">
<th colspan="10">{tr}Group{/tr} {$comp.bom_group}</th>
</tr>
{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}
<tr{if $row.level < 0 || ($showBom && $remaining < 0)} class="danger"{elseif $row.level == 0} class="warning"{/if}>
{if $smarty.foreach.stockRow.first}
<td rowspan="{$comp.stock|@count}">
<a href="{$comp.display_url|escape}">{$comp.title|escape}</a>
</td>
<td rowspan="{$comp.stock|@count}">{$comp.data|escape}</td>
<td rowspan="{$comp.stock|@count}">{$comp.part_number|escape}</td>
{/if}
{if $showBom}<td class="text-right">{math equation="b*k" b=$row.bom_qty k=$kitCount format="%.0f"}</td>{/if}
<td>{$qtype|escape}</td>
<td class="text-right">{$row.level|string_format:"%.0f"}</td>
{if $showBom}
<td class="text-right{if $remaining < 0} text-danger{/if}">{$remaining|string_format:"%.0f"}</td>
{/if}
</tr>
{/foreach}
{/foreach}
</tbody>
</table>
{else}
<p class="muted">{tr}No stock records found.{/tr}</p>
{/if}
</section>
</div>
{/strip}
|