IO-1914 Added inventory page.
This commit is contained in:
@@ -10,6 +10,9 @@
|
||||
- function:
|
||||
schema: public
|
||||
name: search_exportlog
|
||||
- function:
|
||||
schema: public
|
||||
name: search_inventory
|
||||
- function:
|
||||
schema: public
|
||||
name: search_jobs
|
||||
|
||||
@@ -2199,6 +2199,7 @@
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
allow_aggregations: true
|
||||
update_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
|
||||
40
hasura/migrations/1654022042838_run_sql_migration/down.sql
Normal file
40
hasura/migrations/1654022042838_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,40 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- 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$;
|
||||
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$;
|
||||
37
hasura/migrations/1654023497348_run_sql_migration/down.sql
Normal file
37
hasura/migrations/1654023497348_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- 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 inner JOIN billlines ON inventory.billlineid = billlines.id
|
||||
-- inner JOIN bills ON billlines.billid = bills.id
|
||||
-- inner JOIN vendors ON bills.vendorid = vendors.id
|
||||
--
|
||||
-- WHERE
|
||||
-- inventory.line_desc ILIKE '%' || search || '%'
|
||||
-- OR bills.invoice_number ILIKE '%' || search || '%'
|
||||
-- OR vendors.name ILIKE '%' || search || '%'
|
||||
-- ORDER BY
|
||||
-- inventory.line_desc ILIKE '%' || search || '%'
|
||||
-- OR NULL,
|
||||
-- bills.invoice_number ILIKE '%' || search || '%'
|
||||
-- OR NULL,
|
||||
-- vendors.name ILIKE '%' || search || '%'
|
||||
-- OR NULL;
|
||||
-- END IF;
|
||||
-- END
|
||||
-- $function$;
|
||||
35
hasura/migrations/1654023497348_run_sql_migration/up.sql
Normal file
35
hasura/migrations/1654023497348_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
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 inner JOIN billlines ON inventory.billlineid = billlines.id
|
||||
inner JOIN bills ON billlines.billid = bills.id
|
||||
inner JOIN vendors ON bills.vendorid = vendors.id
|
||||
|
||||
WHERE
|
||||
inventory.line_desc ILIKE '%' || search || '%'
|
||||
OR bills.invoice_number ILIKE '%' || search || '%'
|
||||
OR vendors.name ILIKE '%' || search || '%'
|
||||
ORDER BY
|
||||
inventory.line_desc ILIKE '%' || search || '%'
|
||||
OR NULL,
|
||||
bills.invoice_number ILIKE '%' || search || '%'
|
||||
OR NULL,
|
||||
vendors.name ILIKE '%' || search || '%'
|
||||
OR NULL;
|
||||
END IF;
|
||||
END
|
||||
$function$;
|
||||
37
hasura/migrations/1654023506265_run_sql_migration/down.sql
Normal file
37
hasura/migrations/1654023506265_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- 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 inner JOIN billlines ON inventory.billlineid = billlines.id
|
||||
-- inner JOIN bills ON billlines.billid = bills.id
|
||||
-- inner JOIN vendors ON bills.vendorid = vendors.id
|
||||
--
|
||||
-- WHERE
|
||||
-- inventory.line_desc ILIKE '%' || search || '%'
|
||||
-- OR bills.invoice_number ILIKE '%' || search || '%'
|
||||
-- OR vendors.name ILIKE '%' || search || '%'
|
||||
-- ORDER BY
|
||||
-- inventory.line_desc ILIKE '%' || search || '%'
|
||||
-- OR NULL,
|
||||
-- bills.invoice_number ILIKE '%' || search || '%'
|
||||
-- OR NULL,
|
||||
-- vendors.name ILIKE '%' || search || '%'
|
||||
-- OR NULL;
|
||||
-- END IF;
|
||||
-- END
|
||||
-- $function$;
|
||||
35
hasura/migrations/1654023506265_run_sql_migration/up.sql
Normal file
35
hasura/migrations/1654023506265_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
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 inner JOIN billlines ON inventory.billlineid = billlines.id
|
||||
inner JOIN bills ON billlines.billid = bills.id
|
||||
inner JOIN vendors ON bills.vendorid = vendors.id
|
||||
|
||||
WHERE
|
||||
inventory.line_desc ILIKE '%' || search || '%'
|
||||
OR bills.invoice_number ILIKE '%' || search || '%'
|
||||
OR vendors.name ILIKE '%' || search || '%'
|
||||
ORDER BY
|
||||
inventory.line_desc ILIKE '%' || search || '%'
|
||||
OR NULL,
|
||||
bills.invoice_number ILIKE '%' || search || '%'
|
||||
OR NULL,
|
||||
vendors.name ILIKE '%' || search || '%'
|
||||
OR NULL;
|
||||
END IF;
|
||||
END
|
||||
$function$;
|
||||
37
hasura/migrations/1654023641223_run_sql_migration/down.sql
Normal file
37
hasura/migrations/1654023641223_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- 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
|
||||
-- inventory.*
|
||||
-- FROM
|
||||
-- inventory inner JOIN billlines ON inventory.billlineid = billlines.id
|
||||
-- inner JOIN bills ON billlines.billid = bills.id
|
||||
-- inner JOIN vendors ON bills.vendorid = vendors.id
|
||||
--
|
||||
-- WHERE
|
||||
-- inventory.line_desc ILIKE '%' || search || '%'
|
||||
-- OR bills.invoice_number ILIKE '%' || search || '%'
|
||||
-- OR vendors.name ILIKE '%' || search || '%'
|
||||
-- ORDER BY
|
||||
-- inventory.line_desc ILIKE '%' || search || '%'
|
||||
-- OR NULL,
|
||||
-- bills.invoice_number ILIKE '%' || search || '%'
|
||||
-- OR NULL,
|
||||
-- vendors.name ILIKE '%' || search || '%'
|
||||
-- OR NULL;
|
||||
-- END IF;
|
||||
-- END
|
||||
-- $function$;
|
||||
35
hasura/migrations/1654023641223_run_sql_migration/up.sql
Normal file
35
hasura/migrations/1654023641223_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
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
|
||||
inventory.*
|
||||
FROM
|
||||
inventory inner JOIN billlines ON inventory.billlineid = billlines.id
|
||||
inner JOIN bills ON billlines.billid = bills.id
|
||||
inner JOIN vendors ON bills.vendorid = vendors.id
|
||||
|
||||
WHERE
|
||||
inventory.line_desc ILIKE '%' || search || '%'
|
||||
OR bills.invoice_number ILIKE '%' || search || '%'
|
||||
OR vendors.name ILIKE '%' || search || '%'
|
||||
ORDER BY
|
||||
inventory.line_desc ILIKE '%' || search || '%'
|
||||
OR NULL,
|
||||
bills.invoice_number ILIKE '%' || search || '%'
|
||||
OR NULL,
|
||||
vendors.name ILIKE '%' || search || '%'
|
||||
OR NULL;
|
||||
END IF;
|
||||
END
|
||||
$function$;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- create index inventory_linedescidx on inventory(line_desc);
|
||||
1
hasura/migrations/1654023762220_run_sql_migration/up.sql
Normal file
1
hasura/migrations/1654023762220_run_sql_migration/up.sql
Normal file
@@ -0,0 +1 @@
|
||||
create index inventory_linedescidx on inventory(line_desc);
|
||||
Reference in New Issue
Block a user