Add unitsLeft field to SearchResult type
This commit is contained in:
@@ -11,6 +11,7 @@ SELECT
|
||||
inventory_items.available,
|
||||
inventory_items.item_group,
|
||||
inventory_items.location,
|
||||
inventory_items.tax_group,
|
||||
inventory_item_groups.group_name,
|
||||
COALESCE(b.sales::numeric, 0::numeric) - COALESCE(cancel.count::numeric, 0::numeric) AS sales,
|
||||
inventory_items.sales_units::numeric - COALESCE(b.sales, 0::bigint)::numeric + COALESCE(c.delta, 0::numeric) + COALESCE(cancel.count::numeric, 0::numeric) AS units_left,
|
||||
|
||||
@@ -6,13 +6,12 @@ SELECT
|
||||
sales_units,
|
||||
available,
|
||||
location_name,
|
||||
location_id,
|
||||
location as location_id,
|
||||
group_name,
|
||||
item_group AS group_id,
|
||||
tax_group AS tax_group_id
|
||||
FROM garfield.inventory_items
|
||||
LEFT JOIN garfield.locations ON location = location_id
|
||||
LEFT JOIN garfield.inventory_item_groups ON item_group = 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
|
||||
|
||||
Reference in New Issue
Block a user