Skip to content

Instantly share code, notes, and snippets.

@anandpdoshi
Last active December 10, 2015 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anandpdoshi/4509292 to your computer and use it in GitHub Desktop.
Save anandpdoshi/4509292 to your computer and use it in GitHub Desktop.
select
so.name as "SO No:Link/Sales Order:100",
so.transaction_date as "SO Date::80",
so_item.item_code as "Item Code:Link/Item:160",
so_item.description as "Description::300",
(so_item.qty - ifnull(so_item.delivered_qty, 0)) as "PEND QTY:Decimal:70",
so_item.reserved_warehouse as "WH::80",
bin.actual_qty as "ACT:Decimal:40",
bin.reserved_qty as "RSVD:Decimal:40",
so.customer as "Customer:Link/Customer:150"
from
`tabSales Order` so,
`tabSales Order Item` so_item
left join `tabBin` bin on (bin.item_code=so_item.item_code
and bin.warehouse=so_item.reserved_warehouse)
where
so_item.parent = so.name
and so.docstatus = 1
and so.status != "Stopped"
and so.transaction_date <= curdate()
and so_item.item_code not in (
"CSP000000-000", "HSP000000-000", "JHKG-01", "JHNO-0075-01", "JCNO-01")
and bin.actual_qty > 0
and ifnull(so_item.delivered_qty,0) < ifnull(so_item.qty,0)
order by so.transaction_date asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment