[Fixed] Merge conflict fixed

This commit is contained in:
Akhilesh Darjee
2013-06-21 13:09:18 +05:30
9 changed files with 143 additions and 154 deletions

View File

@@ -16,7 +16,7 @@
from __future__ import unicode_literals
import webnotes
from controllers.trends import get_columns,get_data
from controllers.trends import get_columns, get_data
def execute(filters=None):
if not filters: filters ={}
@@ -27,8 +27,5 @@ def execute(filters=None):
details = get_columns(filters, trans)
data = get_data(filters, tab, details)
if not data:
webnotes.msgprint("Data not found for selected criterias")
return details["columns"], data

View File

@@ -96,7 +96,7 @@ def get_target_distribution_details(filters):
#Get achieved details from sales order
def get_achieved_details(filters):
start_date, end_date = get_fiscal_year(filters)[1:]
start_date, end_date = get_fiscal_year(fiscal_year = filters["fiscal_year"])[1:]
return webnotes.conn.sql("""select soi.item_code, soi.qty, soi.amount, so.transaction_date,
st.sales_person, MONTHNAME(so.transaction_date) as month_name
@@ -117,20 +117,22 @@ def get_salesperson_item_month_map(filters):
for month in tdd:
sim_map.setdefault(sd.name, {}).setdefault(sd.item_group, {})\
.setdefault(month, webnotes._dict({
"target": 0.0, "achieved": 0.0, "variance": 0.0
"target": 0.0, "achieved": 0.0
}))
tav_dict = sim_map[sd.name][sd.item_group][month]
for ad in achieved_details:
if (filters["target_on"] == "Quantity"):
tav_dict.target = flt(sd.target_qty)*(tdd[month]["percentage_allocation"]/100)
tav_dict.target = flt(sd.target_qty) * \
(tdd[month]["percentage_allocation"]/100)
if ad.month_name == month and get_item_group(ad.item_code) == sd.item_group \
and ad.sales_person == sd.name:
tav_dict.achieved += ad.qty
if (filters["target_on"] == "Amount"):
tav_dict.target = flt(sd.target_amount)*(tdd[month]["percentage_allocation"]/100)
tav_dict.target = flt(sd.target_amount) * \
(tdd[month]["percentage_allocation"]/100)
if ad.month_name == month and get_item_group(ad.item_code) == sd.item_group \
and ad.sales_person == sd.name:
tav_dict.achieved += ad.amount
@@ -138,4 +140,4 @@ def get_salesperson_item_month_map(filters):
return sim_map
def get_item_group(item_name):
return webnotes.conn.get_value("Item", item_name, item_group)
return webnotes.conn.get_value("Item", item_name, "item_group")

View File

@@ -57,8 +57,7 @@ def get_columns(filters):
for fieldname in ["fiscal_year", "period", "target_on"]:
if not filters.get(fieldname):
label = (" ".join(fieldname.split("_"))).title()
msgprint(_("Please specify") + ": " + label,
raise_exception=True)
msgprint(_("Please specify") + ": " + label, raise_exception=True)
columns = ["Territory:Link/Territory:80", "Item Group:Link/Item Group:80"]
@@ -96,7 +95,7 @@ def get_target_distribution_details(filters):
#Get achieved details from sales order
def get_achieved_details(filters):
start_date, end_date = get_fiscal_year(filters)[1:]
start_date, end_date = get_fiscal_year(fiscal_year = filters["fiscal_year"])[1:]
return webnotes.conn.sql("""select soi.item_code, soi.qty, soi.amount, so.transaction_date,
so.territory, MONTHNAME(so.transaction_date) as month_name
@@ -116,20 +115,22 @@ def get_territory_item_month_map(filters):
for month in tdd:
tim_map.setdefault(td.name, {}).setdefault(td.item_group, {})\
.setdefault(month, webnotes._dict({
"target": 0.0, "achieved": 0.0, "variance": 0.0
"target": 0.0, "achieved": 0.0
}))
tav_dict = tim_map[td.name][td.item_group][month]
for ad in achieved_details:
if (filters["target_on"] == "Quantity"):
tav_dict.target = flt(td.target_qty)*(tdd[month]["percentage_allocation"]/100)
tav_dict.target = flt(td.target_qty) * \
(tdd[month]["percentage_allocation"]/100)
if ad.month_name == month and get_item_group(ad.item_code) == td.item_group \
and ad.territory == td.name:
tav_dict.achieved += ad.qty
if (filters["target_on"] == "Amount"):
tav_dict.target = flt(td.target_amount)*(tdd[month]["percentage_allocation"]/100)
tav_dict.target = flt(td.target_amount) * \
(tdd[month]["percentage_allocation"]/100)
if ad.month_name == month and get_item_group(ad.item_code) == td.item_group \
and ad.territory == td.name:
tav_dict.achieved += ad.amount
@@ -137,4 +138,4 @@ def get_territory_item_month_map(filters):
return tim_map
def get_item_group(item_name):
return webnotes.conn.get_value("Item", item_name, item_group)
return webnotes.conn.get_value("Item", item_name, "item_group")