18 lines
467 B
SQL
18 lines
467 B
SQL
SELECT
|
|
item_barcode,
|
|
name,
|
|
unit_price :: float,
|
|
TO_CHAR(bought, 'YYYY-MM-DD') AS bought,
|
|
sales_units,
|
|
available,
|
|
location_name,
|
|
location as location_id,
|
|
group_name,
|
|
item_group AS group_id,
|
|
tax_group AS tax_group_id,
|
|
units_left :: integer
|
|
FROM all_inventory_item_overview
|
|
WHERE (%(location_id)s IS NULL OR location = %(location_id)s)
|
|
AND (name ILIKE CONCAT('%%', %(search_term)s, '%%') OR item_barcode = %(search_term)s)
|
|
ORDER BY bought DESC
|