IO-1914 Added inventory page.
This commit is contained in:
38
hasura/migrations/1654022042838_run_sql_migration/up.sql
Normal file
38
hasura/migrations/1654022042838_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
CREATE OR REPLACE FUNCTION public.search_inventory (search text)
|
||||
RETURNS SETOF inventory
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
IF search = '' THEN
|
||||
RETURN query
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
inventory;
|
||||
ELSE
|
||||
RETURN query
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
inventory i,
|
||||
billlines bl,
|
||||
bills b,
|
||||
vendors v
|
||||
WHERE
|
||||
i.billlineid = bl.id
|
||||
AND bl.billid = b.id
|
||||
AND b.vendorid = v.id
|
||||
AND i.line_desc ILIKE '%' || search || '%'
|
||||
OR b.invoice_number ILIKE '%' || search || '%'
|
||||
OR v.name ILIKE '%' || search || '%'
|
||||
ORDER BY
|
||||
i.line_desc ILIKE '%' || search || '%'
|
||||
OR NULL,
|
||||
b.invoice_number ILIKE '%' || search || '%'
|
||||
OR NULL,
|
||||
v.name ILIKE '%' || search || '%'
|
||||
OR NULL;
|
||||
END IF;
|
||||
END
|
||||
$function$;
|
||||
Reference in New Issue
Block a user