mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
Merge branch 'master' of https://github.com/grocy/grocy
This commit is contained in:
commit
bae83535dd
@ -29,9 +29,16 @@ class StockReportsController extends BaseController
|
||||
|
||||
if ($groupBy == 'product')
|
||||
{
|
||||
if (isset($request->getQueryParams()['product-group']) and $request->getQueryParams()['product-group'] != 'all')
|
||||
if (isset($request->getQueryParams()['product-group']))
|
||||
{
|
||||
$where .= ' AND pg.id = ' . $request->getQueryParams()['product-group'];
|
||||
if ($request->getQueryParams()['product-group'] == 'ungrouped')
|
||||
{
|
||||
$where .= ' AND pg.id IS NULL';
|
||||
}
|
||||
elseif ($request->getQueryParams()['product-group'] != 'all')
|
||||
{
|
||||
$where .= ' AND pg.id = ' . $request->getQueryParams()['product-group'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "
|
||||
@ -44,7 +51,7 @@ class StockReportsController extends BaseController
|
||||
FROM products_price_history pph
|
||||
JOIN products p
|
||||
ON pph.product_id = p.id
|
||||
JOIN product_groups pg
|
||||
LEFT JOIN product_groups pg
|
||||
ON p.product_group_id = pg.id
|
||||
WHERE $where
|
||||
GROUP BY p.id, p.name, pg.id, pg.name
|
||||
@ -61,7 +68,7 @@ class StockReportsController extends BaseController
|
||||
FROM products_price_history pph
|
||||
JOIN products p
|
||||
ON pph.product_id = p.id
|
||||
JOIN product_groups pg
|
||||
LEFT JOIN product_groups pg
|
||||
ON p.product_group_id = pg.id
|
||||
WHERE $where
|
||||
GROUP BY pg.id, pg.name
|
||||
|
@ -4,7 +4,7 @@ var totalAmount = 0.0;
|
||||
$("#metrics-table tbody tr").each(function()
|
||||
{
|
||||
var self = $(this);
|
||||
labels.push(self.find("td:eq(0)").attr("data-chart-label"));
|
||||
labels.push(self.find("td:eq(0)").text().trim());
|
||||
var itemTotal = Number.parseFloat(self.find("td:eq(1)").attr("data-chart-value"));
|
||||
data.push(itemTotal);
|
||||
totalAmount += + itemTotal;
|
||||
|
@ -77,6 +77,8 @@
|
||||
<option @if($productGroup->id == $selectedGroup) selected="selected" @endif
|
||||
value="{{ $productGroup->id }}">{{ $productGroup->name }}</option>
|
||||
@endforeach
|
||||
<option class="font-italic font-weight-light"
|
||||
value="ungrouped">{{ $__t('Ungrouped') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -112,8 +114,16 @@
|
||||
<tbody class="d-none">
|
||||
@foreach($metrics as $metric)
|
||||
<tr>
|
||||
<td data-chart-label="{{ $metric->name }}">
|
||||
<td>
|
||||
@if($groupBy == 'productgroup')
|
||||
@if(empty($metric->name))
|
||||
<span class="font-italic font-weight-light">{{ $__t('Ungrouped') }}</span>
|
||||
@else
|
||||
{{ $metric->name }}
|
||||
@endif
|
||||
@else
|
||||
{{ $metric->name }}
|
||||
@endif
|
||||
</td>
|
||||
<td data-chart-value="{{ $metric->total }}"
|
||||
data-order="{{ $metric->total }}">
|
||||
@ -121,7 +131,11 @@
|
||||
</td>
|
||||
@if($groupBy == 'product')
|
||||
<td>
|
||||
@if(empty($metric->group_name))
|
||||
<span class="font-italic font-weight-light">{{ $__t('Ungrouped') }}</span>
|
||||
@else
|
||||
{{ $metric->group_name }}
|
||||
@endif
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user