Skip to content

Instantly share code, notes, and snippets.

@itsyosefali
Last active January 8, 2023 12:06
Show Gist options
  • Select an option

  • Save itsyosefali/d5435382f03e06dc494923be5255aec3 to your computer and use it in GitHub Desktop.

Select an option

Save itsyosefali/d5435382f03e06dc494923be5255aec3 to your computer and use it in GitHub Desktop.
تقرير تثبيت ال item group بناء على حركة المبيعات وفقا للcost center
select
`tabSales Invoice`.branch,
sum(case when `tabItem`.item_group = 'موكيت' then `tabSales Invoice Item`.qty else 0 end) AS موكيت,
sum(case when `tabItem`.item_group = 'ممرات' then `tabSales Invoice Item`.qty else 0 end) as 'ممرات',
sum(case when `tabItem`.item_group = 'كولا' then `tabSales Invoice Item`.qty else 0 end) as كولا,
sum(case when `tabItem`.item_group = 'سجاد' then `tabSales Invoice Item`.qty else 0 end) as 'سجاد',
sum(case when `tabItem`.item_group = 'دواسات' then `tabSales Invoice Item`.qty else 0 end) as دواسات
from `tabSales Invoice Item`
INNER JOIN `tabSales Invoice`
on `tabSales Invoice`.name = `tabSales Invoice Item`.parent
INNER JOIN `tabItem`
on `tabItem`.name = `tabSales Invoice Item`.item_code
Group By
`tabSales Invoice`.branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment