Merge branch 'shf_rename'
This commit is contained in:
commit
c7e26873c0
@ -26,7 +26,7 @@ cur_frm.fields_dict.voucher_no.get_query = function(doc) {
|
||||
and voucher_type = '%(dt)s' \
|
||||
and voucher_no LIKE '%s' \
|
||||
ORDER BY posting_date DESC, voucher_no DESC LIMIT 50 \
|
||||
", {dt:session.rev_dt_labels[doc.voucher_type] || doc.voucher_type, acc:doc.account});
|
||||
", {dt:doc.voucher_type, acc:doc.account});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,9 +316,6 @@ class DocType:
|
||||
|
||||
|
||||
def on_update(self):
|
||||
if self.doc.item != cstr(self.doc.name.split('/')[1]):
|
||||
msgprint("Cannot change Item once the Bill Of Material is created.")
|
||||
raise Exception
|
||||
self.check_recursion()
|
||||
|
||||
|
||||
|
@ -49,12 +49,8 @@ report.get_query = function() {
|
||||
cond1 = 'ifnull(t1.target_amount,"")!=""';
|
||||
cond2 = 'ifnull(t6.target_amount,"")!=""';
|
||||
}
|
||||
if(under =='Sales Invoice')
|
||||
tab = 'RV';
|
||||
else
|
||||
tab = under;
|
||||
|
||||
var q ='SELECT t1.item_group AS "Item Group", '+q1+', t2.distribution_id AS "Distribution Id" FROM `tabTarget Detail` t1, `tabSales Person` t2 WHERE t1.parenttype = "Sales Person" AND t1.parent = "'+sales_person+'" AND t1.parent=t2.name AND ifnull(t1.item_group,"") != "" AND '+cond1+' UNION SELECT t3.item_group AS "Item Group", '+q2+',"" AS "Distribution Id" FROM `tab'+tab+' Detail` t3,`tabSales Team` t4,`tab'+under+'` t5 where t3.item_group NOT IN (SELECT t6.item_group AS "Item Group" FROM `tabTarget Detail` t6, `tabSales Person` t7 WHERE t6.parenttype = "Sales Person" AND t6.parent = "'+sales_person+'" AND t6.parent=t7.name AND '+cond2+') AND t4.sales_person = "'+sales_person+'" AND t3.parent = t5.name AND t4.parent = t5.name AND t5.docstatus = 1';
|
||||
var q ='SELECT t1.item_group AS "Item Group", '+q1+', t2.distribution_id AS "Distribution Id" FROM `tabTarget Detail` t1, `tabSales Person` t2 WHERE t1.parenttype = "Sales Person" AND t1.parent = "'+sales_person+'" AND t1.parent=t2.name AND ifnull(t1.item_group,"") != "" AND '+cond1+' UNION SELECT t3.item_group AS "Item Group", '+q2+',"" AS "Distribution Id" FROM `tab'+under+' Item` t3,`tabSales Team` t4,`tab'+under+'` t5 where t3.item_group NOT IN (SELECT t6.item_group AS "Item Group" FROM `tabTarget Detail` t6, `tabSales Person` t7 WHERE t6.parenttype = "Sales Person" AND t6.parent = "'+sales_person+'" AND t6.parent=t7.name AND '+cond2+') AND t4.sales_person = "'+sales_person+'" AND t3.parent = t5.name AND t4.parent = t5.name AND t5.docstatus = 1';
|
||||
|
||||
return q;
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# validate Filters
|
||||
flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'under' : 'Under', 'sales_person':'Sales Person', 'target_on':'Target On'}
|
||||
for f in flt_dict:
|
||||
@ -22,14 +21,23 @@ for f in flt_dict:
|
||||
raise Exception
|
||||
|
||||
# Get Values from fliters
|
||||
fiscal_year = filter_values.get('fiscal_year')
|
||||
fiscal_year = filter_values.get('fiscal_year')[0]
|
||||
period = filter_values.get('period')
|
||||
under = filter_values.get('under')
|
||||
if under == 'Sales Invoice': under = 'Sales Invoice'
|
||||
sales_person = filter_values.get('sales_person')
|
||||
target_on = filter_values.get('target_on')
|
||||
|
||||
|
||||
# set colnames
|
||||
for d in ['Item Group', 'Total Target Allocated', 'Distribution Id']:
|
||||
colnames.append(d)
|
||||
coltypes.append('Data')
|
||||
colwidths.append('150px')
|
||||
coloptions.append('')
|
||||
col_idx[d] = len(colnames) - 1
|
||||
|
||||
|
||||
|
||||
# Set required field names
|
||||
based_on_fn = 'sales_person'
|
||||
|
||||
@ -89,9 +97,6 @@ def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
|
||||
|
||||
|
||||
|
||||
# make default columns
|
||||
#coltypes[col_idx['Item Group']] = 'Link'
|
||||
#coloptions[col_idx['Item Group']]= 'Sales '
|
||||
|
||||
# get start date
|
||||
start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date')
|
||||
@ -104,7 +109,6 @@ start_date = start_date.strftime('%Y-%m-%d')
|
||||
make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
|
||||
|
||||
|
||||
|
||||
bc_obj = get_obj('Budget Control')
|
||||
for r in res:
|
||||
|
||||
@ -120,16 +124,15 @@ for r in res:
|
||||
actual = 0
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------
|
||||
if target_on == "Quantity":
|
||||
|
||||
actual = sql("select sum(ifnull(t2.qty,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Sales Invoice') and 'RV' or under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
|
||||
actual = sql("select sum(ifnull(t2.qty,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Item` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
|
||||
|
||||
#----------------------------------------------------------
|
||||
if target_on == "Amount":
|
||||
|
||||
actual = sql("select sum(ifnull(t2.amount,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Sales Invoice') and 'RV' or under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
|
||||
actual = sql("select sum(ifnull(t2.amount,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Item` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
|
||||
#----------------------------------------------------------
|
||||
|
||||
actual = actual and flt(actual[0][0]) or 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user