cost centre issue has fixed

This commit is contained in:
gandhimathi 2017-11-06 13:21:14 +05:30
parent e7756e9396
commit 26249101fa

View File

@ -345,49 +345,6 @@ case Cost_Center_Budget.BudgetType
when 'IMPORT'
then ifnull((sum(distinct(PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate)),0)
when 'CAPITAL'
then
case po.CapitalRange
when '0'
then ifnull((sum(distinct(PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate)),0)
else ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0)
end
when 'SERVICE'
then ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0)
when 'REVENUE'
then ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate) - sum(distinct T_Rev_Tax.AfterDiscount)),0)
end
as Util_Amount,
case Cost_Center_Budget.BudgetType
when 'IMPORT'
then (Cost_Center_Budget.BudgetAmount - ifnull((sum(distinct(PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate)),0))
when 'CAPITAL'
then
case po.CapitalRange
when '0'
then (Cost_Center_Budget.BudgetAmount - ifnull((sum(distinct(PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate)),0))
else (Cost_Center_Budget.BudgetAmount - ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0))
end
when 'SERVICE'
then (Cost_Center_Budget.BudgetAmount - ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0))
when 'REVENUE'
then (Cost_Center_Budget.BudgetAmount - ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate) - sum(distinct T_Rev_Tax.AfterDiscount)),0))
end
as Avlbl_Amt
from T_CostCenter_Budget Cost_Center_Budget
left join T_PurchaseOrder_LineItem PO_Line_Item on Cost_Center_Budget.CostCenterCode=PO_Line_Item.CostCenterCode
left JOIN T_PurchaseOrder_Master po on po.PONO=PO_Line_Item.PONO and po.Status !='ST030'
left JOIN T_Revenue_Tax T_Rev_Tax on PO_Line_Item.LineItemNo=T_Rev_Tax.LineItemNo
JOIN T_CostCenter_Master Cost_Mast on Cost_Center_Budget.CostCenterCode=Cost_Mast.CostCenterCode
JOIN T_CostCenter_Departments CostCentDept on CostCentDept.CostCenterCode=Cost_Mast.CostCenterCode
JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode= CostCentDept.DEPCode
WHERE DATE(Cost_Center_Budget.CreatedDate) BETWEEN '2017-04-01' AND '2018-03-31'
group by
Cost_Center_Budget.BudgetYear,Cost_Center_Budget.CostCenterCode,Cost_Center_Budget.BudgetType
order by Cost_Center_Budget.CostCenterCodeSELECT Cost_Center_Budget.CostCenterCode as Cost_Center_Code, CostCenterName as Cost_Center_Name,group_concat(distinct Dept_Details.DepartmentName) as Dept_Name,Cost_Center_Budget.BudgetType as BudgetType,Cost_Center_Budget.BudgetYear as BudgetYear,
case Cost_Center_Budget.BudgetType
when 'IMPORT'
then ifnull((sum(distinct(PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate)),0)
when 'CAPITAL'
then
case po.CapitalRange
when '1'
@ -398,7 +355,7 @@ then
end
when 'SERVICE'
then ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0)
when 'REVENUE'
when 'REVENUE'
then ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate) - sum(distinct T_Rev_Tax.AfterDiscount)),0)
end
as Util_Amount,
@ -427,7 +384,7 @@ left JOIN T_Revenue_Tax T_Rev_Tax on PO_Line_Item.LineItemNo=T_Rev_Tax.LineItemN
JOIN T_CostCenter_Master Cost_Mast on Cost_Center_Budget.CostCenterCode=Cost_Mast.CostCenterCode
JOIN T_CostCenter_Departments CostCentDept on CostCentDept.CostCenterCode=Cost_Mast.CostCenterCode
JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode= CostCentDept.DEPCode
WHERE DATE(Cost_Center_Budget.CreatedDate) BETWEEN '2017-04-01' AND '2018-03-31'
WHERE Cost_Center_Budget.BudgetType = po.POType and DATE(Cost_Center_Budget.CreatedDate) BETWEEN '2017-04-01' AND '2018-03-31'
group by
Cost_Center_Budget.BudgetYear,Cost_Center_Budget.CostCenterCode,Cost_Center_Budget.BudgetType
order by Cost_Center_Budget.CostCenterCode";