further fixes

This commit is contained in:
Anand Doshi 2012-04-12 17:51:53 +05:30
parent 25bc68c7b2
commit 09e8c4cd2d
22 changed files with 24 additions and 1758 deletions

View File

@ -1,137 +0,0 @@
# DocType, Chapter VI A Detail
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:54',
'docstatus': 0,
'modified': '2012-03-27 14:35:54',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': u'HR',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 9
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Chapter VI A Detail',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Chapter VI A Detail',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'role': u'System Manager'
},
# DocType, Chapter VI A Detail
{
'doctype': 'DocType',
'name': u'Chapter VI A Detail'
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 0,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'particulars3',
'fieldtype': u'Small Text',
'label': u'Particulars',
'oldfieldname': u'particulars3',
'oldfieldtype': u'Small Text',
'permlevel': 1,
'reqd': 1,
'width': u'300px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'under_section3',
'fieldtype': u'Data',
'label': u'Under Section',
'oldfieldname': u'under_section3',
'oldfieldtype': u'Data',
'permlevel': 1,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'max_limit3',
'fieldtype': u'Currency',
'label': u'Max. Limit',
'oldfieldname': u'max_limit3',
'oldfieldtype': u'Currency',
'permlevel': 1,
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'actual_amount3',
'fieldtype': u'Currency',
'label': u'Actual Amount',
'oldfieldname': u'actual_amount3',
'oldfieldtype': u'Currency',
'permlevel': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'eligible_amount3',
'fieldtype': u'Currency',
'label': u'Eligible Amount',
'oldfieldname': u'eligible_amount3',
'oldfieldtype': u'Currency',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'modified_amount3',
'fieldtype': u'Currency',
'label': u'Modified Amount',
'oldfieldname': u'modified_amount3',
'oldfieldtype': u'Currency',
'permlevel': 0
}
]

View File

@ -1,136 +0,0 @@
# DocType, Declaration Detail
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:54',
'docstatus': 0,
'modified': '2012-03-27 14:35:54',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': u'HR',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 7
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Declaration Detail',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Declaration Detail',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'role': u'System Manager'
},
# DocType, Declaration Detail
{
'doctype': 'DocType',
'name': u'Declaration Detail'
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 0,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'particulars1',
'fieldtype': u'Small Text',
'label': u'Particulars',
'oldfieldname': u'particulars1',
'oldfieldtype': u'Small Text',
'permlevel': 1,
'reqd': 1,
'width': u'200px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'under_section1',
'fieldtype': u'Data',
'label': u'Under Section',
'oldfieldname': u'under_section1',
'oldfieldtype': u'Data',
'permlevel': 1,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'max_limit1',
'fieldtype': u'Currency',
'label': u'Max. Limit',
'oldfieldname': u'max_limit1',
'oldfieldtype': u'Currency',
'permlevel': 1,
'reqd': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'actual_amount1',
'fieldtype': u'Currency',
'label': u'Actual Amount',
'oldfieldname': u'actual_amount1',
'oldfieldtype': u'Currency',
'permlevel': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'eligible_amount1',
'fieldtype': u'Currency',
'label': u'Eligible Amount',
'oldfieldname': u'eligible_amount1',
'oldfieldtype': u'Currency',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'modified_amount1',
'fieldtype': u'Currency',
'label': u'Modified Amount',
'oldfieldname': u'modified_amount1',
'oldfieldtype': u'Currency',
'permlevel': 0
}
]

View File

@ -1,135 +0,0 @@
# DocType, Invest 80 Declaration Detail
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:57',
'docstatus': 0,
'modified': '2012-03-27 14:35:57',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'istable': 1,
'module': u'HR',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 10
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Invest 80 Declaration Detail',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Invest 80 Declaration Detail',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'role': u'System Manager'
},
# DocType, Invest 80 Declaration Detail
{
'doctype': 'DocType',
'name': u'Invest 80 Declaration Detail'
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 0,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'particulars4',
'fieldtype': u'Small Text',
'label': u'Particulars',
'oldfieldname': u'particulars4',
'oldfieldtype': u'Small Text',
'permlevel': 1,
'reqd': 1,
'width': u'300px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'under_section4',
'fieldtype': u'Data',
'label': u'Under Section',
'oldfieldname': u'under_section4',
'oldfieldtype': u'Data',
'permlevel': 1,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'max_limit4',
'fieldtype': u'Currency',
'label': u'Max. Limit',
'oldfieldname': u'max_limit4',
'oldfieldtype': u'Currency',
'permlevel': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'actual_amount4',
'fieldtype': u'Currency',
'label': u'Actual Amount',
'oldfieldname': u'actual_amount4',
'oldfieldtype': u'Currency',
'permlevel': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'eligible_amount4',
'fieldtype': u'Currency',
'label': u'Eligible Amount',
'oldfieldname': u'eligible_amount4',
'oldfieldtype': u'Currency',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'modified_amount4',
'fieldtype': u'Currency',
'label': u'Modified Amount',
'oldfieldname': u'modified_amount4',
'oldfieldtype': u'Currency',
'permlevel': 0
}
]

View File

@ -1,177 +0,0 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
cur_frm.cscript.onload=function(doc,cdt,cdn){
if(doc.employee && doc.__islocal ==1){
cur_frm.cscript.employee(doc,cdt,cdn);
}
if(doc.rent_acc == "Yes") unhide_field('ann_rent');
}
// when user select an employee corresponding basic, gross income and pf is set.
cur_frm.cscript.employee = function(doc,cdt,cdn){
var mydoc=doc;
$c('runserverobj', args={'method':'set_values','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
function(r, rt) {
var doc = locals[mydoc.doctype][mydoc.name];
if(r.message){
doc.hra_count = r.message;
refresh_field('hra_count')
}
refresh_many(['employee','employee_name','basic','gross_income','pf']);
}
);
}
cur_frm.fields_dict['employee'].get_query = function(doc,dt,dn) {
return 'SELECT tabEmployee.name FROM tabEmployee WHERE tabEmployee.status = "Active" AND tabEmployee.docstatus !=2 AND tabEmployee.name LIKE "%s" ORDER BY tabEmployee.name DESC LIMIT 50'
}
//---------------------------------------------------------
//if rent accomodation is yes then unhide annual rent paid else unhide.
cur_frm.cscript.rent_acc = function(doc,cdt,cdn){
doc.ann_rent = 0
if(doc.rent_acc == 'Yes')
unhide_field('ann_rent');
else
hide_field('ann_rent');
refresh_field('ann_rent');
}
//---------------------------------------------------------
//On done button click check for all values filled or not, and accordingly add records in child tables
cur_frm.cscript.done=function(doc,cdt,cdn){
var mydoc=doc;
if(doc.employee && doc.fiscal_year && doc.metro && doc.sr_citizen && doc.part_sr_citizen && doc.basic && doc.gross_income){
if((doc.rent_acc == "Yes" && doc.ann_rent) || (doc.rent_acc == "No")){
$c('runserverobj', args={'method':'set_tables', 'arg': doc.hra_count, 'docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
function(r, rt) {
var doc = locals[mydoc.doctype][mydoc.name];
refresh_many(['edu_cess','tax_tot_income','net_tot_tax_income','tax_per_month','applicable_from','rem_months']);
refresh_many(['exe_declaration_details','oth_inc_decl_details','chap_via_decl_details','invest_80_decl_details']);
}
);
}
else if(doc.rent_acc == "Yes" && !doc.ann_rent)
alert("Please enter annual rent");
}
else
alert("please fill up all data");
}
//---------------------------------------------------------
//change event of actual amount1 field (exemption declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
cur_frm.cscript.actual_amount1= function(doc,cdt,cdn){
var cl = getchildren('Declaration Detail', doc.name, 'exe_declaration_details');
for(var c=0; c<cl.length; c++) {
if(cl[c].name == cdn){
if(((flt(cl[c].actual_amount1) <= flt(cl[c].max_limit1)) || (flt(cl[c].actual_amount1) == 0)) || ((cl[c].particulars1 != 'House Rent Allowance') && (flt(cl[c].max_limit1) == 0.00)) || ((cl[c].particulars1 == 'House Rent Allowance') && (flt(cl[c].max_limit1) != 0.00) && (flt(cl[c].actual_amount1) <= flt(cl[c].max_limit1)))){
cl[c].eligible_amount1 =cl[c].actual_amount1
cl[c].modified_amount1 =cl[c].actual_amount1
}
else {
cl[c].eligible_amount1 =cl[c].max_limit1
cl[c].modified_amount1 =cl[c].max_limit1
}
refresh_field('exe_declaration_details');
}
}
}
//---------------------------------------------------------
////change event of actual amount2 field (Other Income declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
cur_frm.cscript.actual_amount2= function(doc,cdt,cdn){
var cl = getchildren('Other Income Detail', doc.name, 'oth_inc_decl_details');
for(var c=0; c<cl.length; c++) {
if(cl[c].name == cdn){
if((flt(cl[c].actual_amount2) <= flt(cl[c].max_limit2)) || flt((cl[c].actual_amount2) ==0) || !(cl[c].max_limit2)){
cl[c].eligible_amount2 =cl[c].actual_amount2
cl[c].modified_amount2 =cl[c].actual_amount2
}
else {
cl[c].eligible_amount2 =cl[c].max_limit2
cl[c].modified_amount2 =cl[c].max_limit2
}
refresh_field('oth_inc_decl_details');
}
}
}
//---------------------------------------------------------
//change event of actual amount3 field (Chapter VI A declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
cur_frm.cscript.actual_amount3= function(doc,cdt,cdn){
var cl = getchildren('Chapter VI A Detail', doc.name, 'chap_via_decl_details');
for(var c=0; c<cl.length; c++) {
if(cl[c].name == cdn){
if((flt(cl[c].actual_amount3) <= flt(cl[c].max_limit3)) || flt((cl[c].actual_amount3) ==0) || !(cl[c].max_limit3)){
cl[c].eligible_amount3 =cl[c].actual_amount3
cl[c].modified_amount3 =cl[c].actual_amount3
}
else {
cl[c].eligible_amount3 =cl[c].max_limit3
cl[c].modified_amount3 =cl[c].max_limit3
}
refresh_field('chap_via_decl_details');
}
}
}
//---------------------------------------------------------
//change event of actual amount4 field (Invest 80 declaration detail table) : check for values of actual amount & maximum limit, and accordingly do actions.
cur_frm.cscript.actual_amount4= function(doc,cdt,cdn){
var cl = getchildren('Invest 80 Declaration Detail', doc.name, 'invest_80_decl_details');
for(var c=0; c<cl.length; c++) {
if(cl[c].name == cdn){
if((flt(cl[c].actual_amount4) <= flt(cl[c].max_limit4)) || flt((cl[c].actual_amount4) ==0) || !(cl[c].max_limit4)){
cl[c].eligible_amount4 =cl[c].actual_amount4
cl[c].modified_amount4 =cl[c].actual_amount4
}
else {
cl[c].eligible_amount4 =cl[c].max_limit4
cl[c].modified_amount4 =cl[c].max_limit4
}
refresh_field('invest_80_decl_details');
}
}
}
cur_frm.cscript.refresh=function(doc,cdt,cdn){
}

View File

@ -1,429 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Please edit this list and import only required elements
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
from webnotes.model.doclist import getlist, copy_doclist
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
from webnotes import session, form, is_testing, msgprint, errprint
set = webnotes.conn.set
sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
class DocType:
#init function
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
def autoname(self):
self.doc.name = make_autoname('IT Check/' +self.doc.employee + '/.#####')
#===========================================================
#check for already exist IT Checklist for resp. Employee
def exist_IT_Check(self):
#query for return already exist IT Checklist for respective employee
exist_ret = sql("select name from `tabIT Checklist` where is_cheklist_active = 'Yes' and employee = '%s' and name!='%s'"%(self.doc.employee,self.doc.name))
# validation - if exist then raise exception
if exist_ret:
msgprint("Active IT Checklist '%s' for employee '%s' exist."%(exist_ret[0][0],self.doc.employee))
self.doc.employee = ""
self.doc.basic = 0
self.doc.gross_income = 0
self.doc.pf = 0
return 0
else:
flag = self.exist_sal_struct() #check for slaray structure exist or not, if exist then further action can be done.
return flag
#===========================================================
#check for salary structure exist or not, if exist then further action can be done.
def exist_sal_struct(self):
#query return salary structure for particular employee exist or not
exist_salstr=sql("select name from `tabSalary Structure` where employee = '%s' and is_active='Yes'"%self.doc.employee)
if not exist_salstr:
msgprint("Please first create salary structure for employee '%s'"%self.doc.employee)
self.doc.employee = ''
return 0
else:
return 1
#===========================================================
#get previous salary slip gross income and basic amount
def get_info(self):
ret_sal_slip = sql("select count(name), sum(gross_pay) from `tabSalary Slip` where docstatus =1 and fiscal_year = '%s' and employee = '%s'"%(self.doc.fiscal_year,self.doc.employee))
sum_basic = sum_pf = 0
if ret_sal_slip:
#get name of salary slip of resp. employee
ret_name =convert_to_lists(sql("select name from `tabSalary Slip` where docstatus =1 and fiscal_year = '%s' and employee = '%s' "%(self.doc.fiscal_year,self.doc.employee)))
if ret_name:
for b in ret_name:
#get earning amount of basic
ret_basic = sql("select e_amount from `tabSalary Slip Earning` where parent = '%s' and e_type = 'Basic'"%(b[0]))
sum_basic += ret_basic[0][0] or 0
#get deduction amount of Provident Fund
ret_pf = sql("select d_amount from `tabSalary Slip Deduction` where parent = '%s' and d_type = 'Provident Fund'"%(b[0]))
sum_pf += ret_pf[0][0] or 0
ret_list = [ret_sal_slip[0][0] or 0,ret_sal_slip[0][1] or 0, sum_basic, sum_pf]
return ret_list
#-------------------------------------------
def get_basic_gross(self,ret_list0,ret_list1,ret_list2):
self.doc.basic = self.doc.gross_income = 0
#query return list of earning types and resp. modified amount
ret = convert_to_lists(sql("select e.e_type, e.modified_value from `tabSalary Structure Earning` e , `tabSalary Structure` s where s.is_active = 'Yes' and s.employee='%s' and e.parent = s.name" %(self.doc.employee)))
hra_count=1
if ret:
count = 0.0
for i in ret:
if i[0] == 'Basic':
if i[1] == 0:
msgprint("Basic is zero in salary structure")
self.doc.basic = flt(i[1])*(12-int(ret_list0)) + flt(ret_list2)
count += flt(i[1])
if i[0] =='House Rent Allowance':
hra_count = flt(i[1])
if count == 0:
msgprint("Gross Income is zero in salary structure")
self.doc.gross_income = count*(12-int(ret_list0)) + flt(ret_list1)
if hra_count == 0 or hra_count == "":
hra_count=1
return hra_count
#-------------------------------------------
def get_pf(self,ret_list0,ret_list3):
self.doc.pf = 0.0
#query returns amount
ret_ded = sql("select d.d_modified_amt from `tabSalary Structure Deduction` d , `tabSalary Structure` s where s.is_active = 'Yes' and s.employee='%s' and d.parent = s.name and d.d_type = 'Provident Fund'" %(self.doc.employee))
if not ret_ded:
msgprint("PF Amount in Salary Structure is zero")
ret_ded = flt(ret_ded[0][0]) or 0
#annual pf = salary structure * (12 - remaining month to complete fiscal year)- previous salary slip's total pf for current fiscal year
self.doc.pf = (ret_ded*(12 - int(ret_list0)))+flt(ret_list3)
#-------------------------------------------
def set_values(self):
hra_count=1
if not self.doc.fiscal_year:
msgprint("Please select Fiscal Year")
self.doc.employee = ''
elif self.doc.employee:
flag = self.exist_IT_Check() #check for already exist IT Checklist for resp. Employee
if flag == 1:
ename = sql("select employee_name from `tabEmployee` where name = '%s'"%self.doc.employee)[0][0]
set(self.doc,'employee_name',cstr(ename))
#call get_info to get values of salary slip's total basic, pf and gross income amount
ret_list = self.get_info()
self.get_pf(ret_list[0],ret_list[3])
hra_count = self.get_basic_gross(ret_list[0],ret_list[1],ret_list[2])
return hra_count
#===========================================================
#-------------------------------------------
def set_tables(self, hra_count): #set tables values
self.set_exemption_table(hra_count)
self.set_other_income_table()
self.set_deduction_via_table()
self.set_invest_80c_table()
self.doc.edu_cess = self.doc.tax_tot_income = self.doc.net_tot_tax_income = self.doc.tax_per_month = 0
self.doc.applicable_from = self.doc.rem_months=''
msgprint("Successful")
return ''
#-------------------------------------------
def get_month_diff(self):
#end_month = get_defaults()['end_month']
month_dict = {"January" :'01', "February" :'02',"March" :'03',"April":'04',"May":'05',"June":'06',"July":'07',"August":'08',"September":'09',"October":'10',"November":'11',"December":'12'}
import datetime
start_month = getdate(get_defaults()['year_start_date']).month
end_month = cint(start_month) - 1
if end_month <= 0:
end_month = 12
str_end_month = cstr(end_month)
if len(str_end_month)==1:
str_end_month = '0'+str_end_month
to_month = datetime.date.today().strftime("%B")
to_year = datetime.date.today().strftime("%Y")
fiscal_year = self.doc.fiscal_year
str_fy =fiscal_year.split("-")
endym=int(str_fy[1]+str_end_month)
startym= int(to_year+month_dict[to_month])
month_diff =sql("SELECT PERIOD_DIFF(%d,%d);" %(endym,startym))[0][0]+1
return month_diff
#-------------------------------------------
def set_exemption_values(self,ann_hra):
ret = convert_to_lists(sql("select name, exemption_limit from `tabEarning Type` where taxable = 'No' and docstatus !=2"))
if ret:
for r in ret:
ch = addchild(self.doc,'exe_declaration_details','Declaration Detail',0, self.doclist)
ch.particulars1 = r[0]
ch.under_section1 = "U/Sec 10 & 17"
if r[0] == 'House Rent Allowance':
if (self.doc.ann_rent <= 0.00):
ch.max_limit1 = 0.00
else:
hra1=0.00
if(self.doc.metro == 'Yes'):
hra1 = flt(self.doc.basic)*50/100
elif(self.doc.metro == 'No'):
hra1 = flt(self.doc.basic)*40/100
hra2 = flt(ann_hra)
hra3 = flt(self.doc.ann_rent) - (flt(self.doc.basic)/10)
if hra1 <= 0 or hra2 <=0 or hra3 <=0:
ch.max_limit1 = 0
else:
ch.max_limit1=min(hra1,min(hra2,hra3))
else:
ch.max_limit1 = r[1]
ch.actual_amount1 = 0.00
ch.eligible_amount1 = 0.00
ch.modified_amount1 = 0.00
#-------------------------------------------
def set_exemption_table(self, hra_count):
self.doc.clear_table(self.doclist, 'exe_declaration_details',1)
ann_hra = 0
if (self.doc.ann_rent > 0):
#query return sum of earning types amount where earning type = 'HRA'
ret_sal_slip = sql("select sum(e.e_amount) from `tabSalary Slip Earning` e , `tabSalary Slip` s where s.fiscal_year = '%s' and s.docstatus = 1 and s.employee='%s' and e.parent = s.name and e.e_type = 'House Rent Allowance'" %(self.doc.fiscal_year,self.doc.employee))
if not ret_sal_slip:
ret_sal_slip = 0.00
else:
ret_sal_slip = ret_sal_slip[0][0]
month_diff = self.get_month_diff()
#ret_sal_slip = ret_sal_slip[0][0] or 0.00
ann_hra = (flt(hra_count)*flt(month_diff))+flt(ret_sal_slip);
self.set_exemption_values(ann_hra)
#-------------------------------------------
def set_other_income_table(self):
self.doc.clear_table(self.doclist, 'oth_inc_decl_details',1)
other_income =[["Income from Housing","----",0.00],["Relief on interest paid on Housing Loan","U/S 24(1)(Vi)",150000],["Any other Income","----",0.00]]
for oi in other_income:
ch1 = addchild(self.doc,'oth_inc_decl_details','Other Income Detail',0, self.doclist)
ch1.particulars2 = oi[0]
ch1.under_section2 = oi[1]
ch1.max_limit2 = oi[2]
ch1.actual_amount2 = 0.00
ch1.eligible_amount2 = 0.00
ch1.modified_amount2 = 0.00
#---------------------------------------
def get_maxlmt_via(self):
if(self.doc.part_sr_citizen == 'Yes'):
max_lmt1 = 20000
else:
max_lmt1 = 15000
if(self.doc.per_dep_dis == "Less than 80% disability"):
max_lmt2 = 50000
elif(self.doc.per_dep_dis == "More than 80% disability"):
max_lmt2 = 100000
else:
max_lmt2 = 0.00
if(self.doc.per_self_dis == "Less than 80% disability"):
max_lmt3 = 50000
elif(self.doc.per_self_dis == "More than 80% disability"):
max_lmt3 = 75000
else:
max_lmt3 = 0.00
maxlmt_lst=[max_lmt1,max_lmt2,max_lmt3]
return maxlmt_lst
#---------------------------------------
def set_deduction_via_table(self):
self.doc.clear_table(self.doclist, 'chap_via_decl_details',1)
maxlmt_lst = self.get_maxlmt_via()
deduct_via = [["Medical Insurance Premium","U/Sec 80D(2A)",15000],["Medical Insurance Premium for parents","U/Sec 80D(2A)", maxlmt_lst[0]],["Medical for handicapped dependents","U/Sec 80DD",maxlmt_lst[1]],["Medical for specified diseases","U/Sec 80DDB",40000],["Higher Education Loan Interest Repayment","U/Sec 80E",0.00],["*Donation to approved Fund and charities","U/sec 80G",0.00],["*Rent deduction only if HRA not received","U/sec 80GG",0.00],["Deduction for permanent disability","U/Sec 80 U",maxlmt_lst[2]],["Any other deductions","----",0.00]]
for dv in deduct_via:
ch = addchild(self.doc,'chap_via_decl_details','Chapter VI A Detail',0, self.doclist)
ch.particulars3 = dv[0]
ch.under_section3 = dv[1]
ch.max_limit3 = dv[2]
ch.actual_amount3 = 0.00
ch.eligible_amount3 = 0.00
ch.modified_amount3 = 0.00
#----------------------------------------
def set_invest_80c_table(self):
self.doc.clear_table(self.doclist, 'invest_80_decl_details',1)
invest_lst = [["Employees Provident Fund","U/Sec 80C",0.00],["Voluntary Contribution Provident Fund","U/Sec 80C",0.00],["Investment in Pension Scheme","U/Sec 80 CCC",10000],["Housing Loan Principal Repayment","U/Sec 80C",0.00],["Public Provident Fund (PPF)","U/Sec 80C",0.00],["Life Insurance Premium Paid","U/Sec 80C",0.00],["Unit Linked Insurance Plans","U/Sec 80C",0.00],["NSC - National Saving Certificate","U/Sec 80C",0.00],["Deposite in National Saving Scheme (NSS)","U/Sec 80C",0.00],["Infrastructure Investment in approved Shares, Debentures & Bonds","U/Sec 80C",0.00],["Mutual Funds notified under Section 10 (23D)","U/Sec 80C",0.00],["Equity Link Saving Scheme (ELSS) Mutual Funds notified under Section 10 (23D)","U/Sec 80C",0.00],["Term Deposite with a SCH. Bank in a notified Scheme for a team not less than 5 years ","U/Sec 80C",0.00],["Tution Fees Paid (Only full time education tution fees paid to any Indian Univ, College, School)","U/Sec 80C","24000"],["Senior Citizen Savings Scheme Rules, 2004","U/Sec 80C",0.00],["Post Office Time Deposit Rules, 1981 for a term not less than 5 years","U/Sec 80C",0.00]]
for il in invest_lst:
ch = addchild(self.doc,'invest_80_decl_details','Invest 80 Declaration Detail',0, self.doclist)
ch.particulars4 = il[0]
ch.under_section4 = il[1]
ch.max_limit4 = il[2]
ch.actual_amount4 = 0.00
ch.eligible_amount4 = 0.00
ch.modified_amount4 = 0.00
#---------------------------------------
def sum_mod_val(self):
count = count1 = count2 = 0.0
for e in getlist(self.doclist,'exe_declaration_details'):
count += flt(e.modified_amount1)
count = round(flt(self.doc.gross_income)) - count
for oi in getlist(self.doclist,'oth_inc_decl_details'):
count += flt(oi.modified_amount2)
for vi in getlist(self.doclist,'chap_via_decl_details'):
count2 += flt(vi.modified_amount3)
count = count - count2
for inv in getlist(self.doclist,'invest_80_decl_details'):
count1 += flt(inv.modified_amount4)
if(count1 >= 100000):
break
if(count1>100000):
count1=100000
count_lst = [count,count1]
return count_lst
#----------------------------------------
def calculate_tax(self):
count_lst = self.sum_mod_val()
count = round(flt(count_lst[0]) - flt(count_lst[1]))
if(count>0):
self.doc.net_tot_tax_income = count
ret_gender = sql("select gender from `tabEmployee` where name = '%s' "%self.doc.employee)[0][0]
if(self.doc.sr_citizen == 'Yes'):
self.calc_tax(count,240000)
elif(ret_gender == 'Male'):
self.calc_tax(count,160000)
elif(ret_gender == 'Female'):
self.calc_tax(count,190000)
else:
self.doc.net_tot_tax_income = 0
self.doc.tax_tot_income = 0
self.doc.edu_cess = 0
#-----------------------------------------------
def calc_tax(self,count,upper_limit):
balance = 0
tax = 0
if(count> upper_limit):
balance = count - upper_limit
if balance > (500000 - upper_limit):
balance = balance - (500000 - upper_limit)
tax = round(balance/10)
if balance > 300000:
balance = balance - 300000
tax = round(tax+ 60000)
if balance > 0:
tax = round(tax + (balance * 30 / 100))
else:
tax = round(balance * 20 / 100 )
else:
tax = round(balance /10)
else:
tax = 0
self.doc.tax_tot_income = tax
self.doc.edu_cess = round(tax*3/100)
#-----------------------------------------------
def calc_tax_pm(self):
ret_income_tax = 0
ret_income_tax = sql("select sum(d.d_amount) from `tabSalary Slip Deduction` d , `tabSalary Slip` s where s.docstatus = 1 and s.fiscal_year = '%s' and s.employee='%s' and d.parent = s.name and d.d_type = 'Income Tax'" %(self.doc.fiscal_year,self.doc.employee))
new_tot_income = cint(self.doc.tax_tot_income) + cint(self.doc.edu_cess) - (cint(ret_income_tax[0][0]) or 0)
self.doc.tax_per_month = new_tot_income/cint(self.doc.rem_months)

View File

@ -1,605 +0,0 @@
# DocType, IT Checklist
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:57',
'docstatus': 0,
'modified': '2012-03-27 14:35:57',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'colour': u'White:FFF',
'doctype': 'DocType',
'module': u'HR',
'name': '__common__',
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 455
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'IT Checklist',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'IT Checklist',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1
},
# DocType, IT Checklist
{
'doctype': 'DocType',
'name': u'IT Checklist'
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'System Manager',
'submit': 0,
'write': 1
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'HR User',
'write': 1
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'HR Manager',
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'System Manager'
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'HR User'
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'HR Manager'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'trash_reason',
'fieldtype': u'Small Text',
'label': u'Trash Reason',
'oldfieldname': u'trash_reason',
'oldfieldtype': u'Small Text',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'fiscal_year',
'fieldtype': u'Data',
'in_filter': 1,
'label': u'Fiscal Year',
'oldfieldname': u'fiscal_year',
'oldfieldtype': u'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'default': u'Yes',
'doctype': u'DocField',
'fieldname': u'is_cheklist_active',
'fieldtype': u'Select',
'label': u'Is IT Cheklist Active?',
'oldfieldname': u'is_cheklist_active',
'oldfieldtype': u'Select',
'options': u'Yes\nNo',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'employee_information',
'fieldtype': u'Section Break',
'label': u'Employee Information',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break1',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'employee',
'fieldtype': u'Link',
'label': u'Employee',
'oldfieldname': u'employee',
'oldfieldtype': u'Link',
'options': u'Employee',
'permlevel': 0,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'employee_name',
'fieldtype': u'Data',
'label': u'Employee Name',
'oldfieldname': u'employee_name',
'oldfieldtype': u'Data',
'permlevel': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'hra_count',
'fieldtype': u'Currency',
'hidden': 1,
'label': u'HRA Count',
'no_copy': 0,
'oldfieldname': u'hra_count',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'metro',
'fieldtype': u'Select',
'label': u'Is location a metro city?',
'oldfieldname': u'metro',
'oldfieldtype': u'Select',
'options': u'\nYes\nNo',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'sr_citizen',
'fieldtype': u'Select',
'label': u'Is senior citizen?',
'oldfieldname': u'sr_citizen',
'oldfieldtype': u'Select',
'options': u'\nYes\nNo',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'part_sr_citizen',
'fieldtype': u'Select',
'label': u'Parents are sr. citizen?',
'oldfieldname': u'part_sr_citizen',
'oldfieldtype': u'Select',
'options': u'\nYes\nNo',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'basic',
'fieldtype': u'Currency',
'label': u'Annual Basic',
'oldfieldname': u'basic',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'description': u'sum of earning terms',
'doctype': u'DocField',
'fieldname': u'gross_income',
'fieldtype': u'Currency',
'label': u'Annual Gross Income',
'oldfieldname': u'gross_income',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'description': u'Please fill up all data then press "Done"',
'doctype': u'DocField',
'fieldname': u'done',
'fieldtype': u'Button',
'label': u'Done',
'oldfieldtype': u'Button',
'permlevel': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break2',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'rent_acc',
'fieldtype': u'Select',
'label': u'Having rented accomodation?',
'oldfieldname': u'rent_acc',
'oldfieldtype': u'Select',
'options': u'\nYes\nNo',
'permlevel': 0,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'ann_rent',
'fieldtype': u'Currency',
'hidden': 1,
'label': u'Enter annual rent paid',
'oldfieldname': u'ann_rent',
'oldfieldtype': u'Currency',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Disability % of the Handicapped Dependents',
'doctype': u'DocField',
'fieldname': u'per_dep_dis',
'fieldtype': u'Select',
'label': u'Dependents Disability %',
'oldfieldname': u'per_dep_dis',
'oldfieldtype': u'Select',
'options': u'\nLess than 80% disability\nMore than 80% disability',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'per_self_dis',
'fieldtype': u'Select',
'label': u'Self disability %',
'oldfieldname': u'per_self_dis',
'oldfieldtype': u'Select',
'options': u'\nLess than 80% disability\nMore than 80% disability',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'pf',
'fieldtype': u'Currency',
'label': u'Annual PF',
'oldfieldname': u'pf',
'oldfieldtype': u'Currency',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'exemptions',
'fieldtype': u'Section Break',
'label': u'Exemptions',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'exemptions1',
'fieldtype': u'HTML',
'label': u'Exemptions1',
'oldfieldtype': u'HTML',
'options': u'<b>Exemptions under section 10 & 17</b>',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'exe_declaration_details',
'fieldtype': u'Table',
'label': u'Exemption Detail',
'oldfieldname': u'exe_declaration_details',
'oldfieldtype': u'Table',
'options': u'Declaration Detail',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'other_income',
'fieldtype': u'Section Break',
'label': u'Other Income',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'oth_inc_decl_details',
'fieldtype': u'Table',
'label': u'Other Income Details',
'oldfieldname': u'oth_inc_decl_details',
'oldfieldtype': u'Table',
'options': u'Other Income Detail',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'chapter_vi_a',
'fieldtype': u'Section Break',
'label': u'Chapter VI A',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'deduction_chap_via',
'fieldtype': u'HTML',
'label': u'deduction chap via',
'oldfieldtype': u'HTML',
'options': u'<b>Deduction under Chapter VI A</b>',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'chap_via_decl_details',
'fieldtype': u'Table',
'label': u'Chap VI A Details',
'oldfieldname': u'chap_via_decl_details',
'oldfieldtype': u'Table',
'options': u'Chapter VI A Detail',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'80_c',
'fieldtype': u'Section Break',
'label': u'80 C',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'investment_80_c',
'fieldtype': u'HTML',
'label': u'investment 80 C',
'oldfieldtype': u'HTML',
'options': u'<b>Investment under Section 80 C & 80CCC qualifying for deduction upto RS. 1 Lac</b>',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'invest_80_decl_details',
'fieldtype': u'Table',
'label': u'Invest 80 Decl Details',
'oldfieldname': u'invest_80_decl_details',
'oldfieldtype': u'Table',
'options': u'Invest 80 Declaration Detail',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'total_taxable_income',
'fieldtype': u'Section Break',
'label': u'Total Taxable Income',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'calculate',
'fieldtype': u'Button',
'label': u'Calculate',
'oldfieldtype': u'Button',
'options': u'calculate_tax',
'permlevel': 0,
'trigger': u'Server'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'net_tot_tax_income',
'fieldtype': u'Currency',
'label': u'Net Total Taxable Income',
'oldfieldname': u'net_tot_tax_income',
'oldfieldtype': u'Currency',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'tax_tot_income',
'fieldtype': u'Currency',
'label': u'Tax on Total Income',
'oldfieldname': u'tax_tot_income',
'oldfieldtype': u'Currency',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'edu_cess',
'fieldtype': u'Currency',
'label': u'Education Cess',
'oldfieldname': u'edu_cess',
'oldfieldtype': u'Currency',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'applicable_from',
'fieldtype': u'Select',
'label': u'Applicable from ',
'oldfieldname': u'applicable_from',
'oldfieldtype': u'Select',
'options': u'\nJanuary\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'rem_months',
'fieldtype': u'Select',
'label': u'Remaining month in year',
'oldfieldname': u'rem_months',
'oldfieldtype': u'Select',
'options': u'\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'calculate_tax',
'fieldtype': u'Section Break',
'label': u'Calculate Tax',
'oldfieldtype': u'Section Break',
'options': u'Simple',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'calculate_monthly_tax',
'fieldtype': u'Button',
'label': u'Calculate Monthly Tax ',
'oldfieldtype': u'Button',
'options': u'calc_tax_pm',
'permlevel': 0,
'trigger': u'Server'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'tax_per_month',
'fieldtype': u'Currency',
'label': u'Tax per Month',
'oldfieldname': u'tax_per_month',
'oldfieldtype': u'Currency',
'permlevel': 0
}
]

View File

@ -16,7 +16,10 @@ def execute():
'BOM Replace Utility Detail', 'BOM Replace Utility',
'Absent Days Detail', 'Activity Dashboard Control', 'Raw Materials Supplied',
'Setup Wizard Control', 'Company Group', 'Lease Agreement', 'Lease Installment',
'Terms and Conditions', 'Time Sheet', 'Time Sheet Detail', 'Naming Series Options'],
'Terms and Conditions', 'Time Sheet', 'Time Sheet Detail', 'Naming Series Options',
'Invest 80 Declaration Detail', 'IT Checklist', 'Chapter VI A Detail', 'Declaration Detail',
'Personalize', 'Salary Slip Control Panel',
],
'Page' : ['File Browser'],
'DocType Mapper': ['Production Forecast-Production Planning Tool', 'Production Forecast-Production Plan', 'Sales Order-Production Plan']
}

View File

@ -71,7 +71,7 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
}
}
lst.make(cur_frm.fields_dict['Updates HTML'].wrapper);
lst.make(cur_frm.fields_dict['updates_html'].wrapper);
cur_frm.mylist = lst;
lst.run();
}
@ -81,7 +81,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
// show activities only after project is saved
var fl = ['new_update','Add','hours','Updates HTML'];
var fl = ['new_update','add','hours','updates_html'];
if(doc.__islocal) {
hide_field(fl);}
else {
@ -96,4 +96,4 @@ cur_frm.cscript.add = function(doc, dt, dn) {
}
$c_obj([doc],'add_update','',callback);
}
}

View File

@ -20,7 +20,15 @@ wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(user =='Guest'){
hide_field(['status', 'naming_series', 'order_lost_reason', 'customer', 'rating', 'fax', 'website', 'territory', 'TerritoryHelp', 'address_line1', 'address_line2', 'city', 'state', 'country', 'pincode', 'address', 'lead_owner', 'market_segment', 'industry', 'campaign_name', 'interested_in', 'company', 'fiscal_year', 'contact_by', 'contact_date', 'last_contact_date', 'contact_date_ref', 'to_discuss', 'More Info', 'follow_up', 'Communication History', 'cc_to', 'subject', 'message', 'Attachment Html', 'Create New File', 'lead_attachment_detail', 'Send Email', 'Email', 'Create Customer', 'Create Opportunity', 'Next Steps', 'transaction_date', 'type', 'source']);
hide_field(['status', 'naming_series', 'order_lost_reason',
'customer', 'rating', 'fax', 'website', 'territory',
'TerritoryHelp', 'address_line1', 'address_line2', 'city', 'state',
'country', 'pincode', 'address', 'lead_owner', 'market_segment',
'industry', 'campaign_name', 'interested_in', 'company',
'fiscal_year', 'contact_by', 'contact_date', 'last_contact_date',
'contact_date_ref', 'to_discuss', 'more_info', 'follow_up',
'communication_history', 'cc_to', 'subject', 'message', 'lead_attachment_detail',
'Create Customer', 'Create Opportunity', 'transaction_date', 'type', 'source']);
doc.source = 'Website';
}
if(!doc.status) set_multiple(dt,dn,{status:'Open'});
@ -53,24 +61,6 @@ cur_frm.cscript.status = function(doc, cdt, cdn){
cur_frm.cscript.refresh(doc, cdt, cdn);
}
/*
// *********** Country ******************
// This will show states belonging to country
cur_frm.cscript.country = function(doc, cdt, cdn) {
var mydoc=doc;
$c('runserverobj', args={'method':'check_state', 'docs':compress_doclist([doc])},
function(r,rt){
if(r.message) {
var doc = locals[mydoc.doctype][mydoc.name];
doc.state = '';
get_field(doc.doctype, 'state' , doc.name).options = r.message;
refresh_field('state');
}
}
);
}
*/
cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
var call_back = function(){
var sb_obj = new SalesBrowser();
@ -80,12 +70,6 @@ cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
loadpage('Sales Browser',call_back);
}
// Create New File
// ===============================================================
cur_frm.cscript['Create New File'] = function(doc){
new_doc("File");
}
//Trigger in Item Table
//===================================
cur_frm.cscript.item_code=function(doc,cdt,cdn){

View File

@ -21,12 +21,10 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn){
//
if(!doc.docstatus){
hide_field(['Update Communication Log']);
hide_field(['email_id1','cc_to','subject','message','Attachment Html', 'Create New File', 'enquiry_attachment_detail','Send Email']);
hide_field(['email_id1','cc_to','subject','message', 'enquiry_attachment_detail']);
}
else{
unhide_field(['Update Communication Log']);
unhide_field(['email_id1','cc_to','subject','message','Attachment Html', 'Create New File', 'enquiry_attachment_detail','Send Email']);
unhide_field(['email_id1','cc_to','subject','message', 'enquiry_attachment_detail']);
}
@ -221,25 +219,6 @@ cur_frm.cscript.new_contact = function(){
loaddoc('Contact', tn);
}
*/
//=======================================================================================================================
cur_frm.cscript['Create New File'] = function(doc){
var fl = LocalDB.create('File');
fl = locals['File'][fl];
loaddoc('File', fl.name);
}
//update follow up
//=================================================================================
cur_frm.cscript['Update Communication Log'] = function(doc,cdt,cdn){
$c_obj(make_doclist(doc.doctype, doc.name),'update_follow_up','',function(r, rt){
refresh_field('follow_up');
doc.__unsaved = 0;
cur_frm.refresh_header();
});
}
// Create New Quotation
// =======================================================================================================================
cur_frm.cscript['Create Quotation'] = function(){

View File

@ -198,14 +198,6 @@ class DocType(TransactionBase):
set(self.doc, 'order_lost_reason', arg)
return 'true'
# ====================================================================================================================
def update_follow_up(self):
sql("delete from `tabCommunication Log` where parent = '%s'"%self.doc.name);
for d in getlist(self.doclist, 'follow_up'):
d.save()
self.doc.save()
# On Send Email
# ====================================================================================================================

View File

@ -90,9 +90,6 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.add_custom_button('Set as Lost', cur_frm.cscript['Declare Order Lost']);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
}
if (!doc.docstatus) hide_field(['Update Communication Log']);
else unhide_field(['Update Communication Log']);
}
@ -198,18 +195,6 @@ cur_frm.cscript.pull_enquiry_detail = function(doc,cdt,cdn){
}
//update follow up
//=================================================================================
cur_frm.cscript['Update Communication Log'] = function(doc){
$c_obj(make_doclist(doc.doctype, doc.name),'update_followup_details','',function(r, rt){
refresh_field('follow_up');
doc.__unsaved = 0;
cur_frm.refresh_header();
});
}
// declare order lost
//-------------------------
cur_frm.cscript['Declare Order Lost'] = function(){
@ -259,18 +244,6 @@ cur_frm.cscript['Declare Order Lost'] = function(){
qtn_lost_dialog.show();
}
// GET REPORT
// ========================================================================================
cur_frm.cscript['Get Report'] = function(doc,cdt,cdn) {
var callback = function(report){
report.set_filter('Sales Order Item', 'Quotation No.',doc.name)
report.dt.run();
}
loadreport('Sales Order Item','Itemwise Sales Details', callback);
}
//===================== Quotation to validation - either customer or lead mandatory ====================
cur_frm.cscript.quot_to_validate = function(doc,cdt,cdn){

View File

@ -92,9 +92,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']);
}
unhide_field(['Repair Sales Order', 'Send SMS', 'message', 'customer_mobile_no'])
unhide_field(['repair_sales_order', 'Send SMS', 'message', 'customer_mobile_no'])
} else {
hide_field(['Repair Sales Order', 'Send SMS', 'message', 'customer_mobile_no'])
hide_field(['repair_sales_order', 'Send SMS', 'message', 'customer_mobile_no'])
}
}

View File

@ -1,17 +0,0 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Settings

View File

@ -1,29 +0,0 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//Tips not required
/*
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
}
*/

View File

@ -21,12 +21,12 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
if(doc.__islocal) {
set_field_options('Price Help', ''); return;
set_field_options('price_help', ''); return;
}
if(!doc.file_list) {
set_field_options('Price Help', '<div class="help_box">To upload a price list, please attach a (.csv) file with 3 columns - <b>Item Code, Price and Currency</b> (no headings necessary). See attachments box in the right column</div>')
set_field_options('price_help', '<div class="help_box">To upload a price list, please attach a (.csv) file with 3 columns - <b>Item Code, Price and Currency</b> (no headings necessary). See attachments box in the right column</div>')
} else {
set_field_options('Price Help', '<div class="help_box">To update prices from the attachment, please click on "Update Prices"</div>')
set_field_options('price_help', '<div class="help_box">To update prices from the attachment, please click on "Update Prices"</div>')
}
}

View File

@ -57,4 +57,4 @@ cur_frm.cscript.select_form = function(doc, cdt, cdn){
call_back_rule(mydoc)
}
);
}
}