Filter to active items only, remove Status column, document widget binding rules
- Add WHERE item_active filter to show only active unused items - Remove Status column from query and table widget - Add widget binding guidance to AGENTS.md (NUMBER inputs cannot use NULLIF pattern due to prepared statement typing) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,6 @@ SELECT
|
||||
WHEN 'F' THEN 'Phantom'
|
||||
ELSE i.item_type
|
||||
END AS "Item Type",
|
||||
CASE WHEN i.item_active THEN 'Active' ELSE 'Inactive' END AS "Status",
|
||||
cc.comment_user AS "Created By",
|
||||
COALESCE(i.item_created, cc.comment_date)::date AS "Date Created",
|
||||
last_txn.last_transaction_date::date AS "Last Transaction",
|
||||
@@ -30,6 +29,7 @@ LEFT JOIN (
|
||||
JOIN invhist ih ON ih.invhist_itemsite_id = isite.itemsite_id
|
||||
GROUP BY isite.itemsite_item_id
|
||||
) last_txn ON last_txn.itemsite_item_id = i.item_id
|
||||
WHERE (CURRENT_DATE - COALESCE(last_txn.last_transaction_date, i.item_created, cc.comment_date)::date)
|
||||
WHERE i.item_active
|
||||
AND (CURRENT_DATE - COALESCE(last_txn.last_transaction_date, i.item_created, cc.comment_date)::date)
|
||||
>= '{{UnusedDays.text}}'::int
|
||||
ORDER BY "Days Unused" DESC
|
||||
|
||||
Reference in New Issue
Block a user