Sourced wnframework-modules from Google Code as erpnext

This commit is contained in:
Pratik Vyas
2011-06-08 14:37:15 +05:30
commit c1e6e4c752
1680 changed files with 162635 additions and 0 deletions

View File

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:39', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Action Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'rule_master', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Master', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Action Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04167', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:43', 'parenttype': 'DocType', 'fieldname': 'rule_master', 'fieldtype': 'Link', 'options': 'DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'rule_field', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Action Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04168', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:43', 'parenttype': 'DocType', 'fieldname': 'rule_field', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'expression', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Expression', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Action Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04169', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-01 15:00:43', 'parenttype': 'DocType', 'fieldname': 'expression', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1,143 @@
cur_frm.cscript.onload = function(doc,cdt,cdn){
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn);
if(doc.amended_from && doc.__islocal) cur_frm.cscript.refresh_appraisal_details(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc,cdt,cdn){
if(user == doc.kra_approver && doc.status == 'Submitted') unhide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
else hide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
if(!doc.docstatus) unhide_field('Fetch Template');
else hide_field('Fetch Template');
}
cur_frm.cscript.refresh_appraisal_details = function(doc, cdt, cdn){
var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
for(var i = 0; i<val.length; i++){
set_multiple('Appraisal Detail', val[i].name, {'target_achieved':'', 'score':'', 'scored_earned':''}, 'appraisal_details');
}
doc.total_score = '';
refresh_field('appraisal_details');
refresh_field('total_score');
}
cur_frm.cscript.employee = function(doc,cdt,cdn){
if(doc.employee){
$c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){
if(r.message){
doc.employee_name = r.message['emp_nm'];
get_field(doc.doctype, 'kra_approver' , doc.name).options = r.message['app_lst'];
refresh_many(['kra_approver','employee_name']);
}
});
}
}
cur_frm.cscript['Calculate Total Score'] = function(doc,cdt,cdn){
//get_server_fields('calculate_total','','',doc,cdt,cdn,1);
var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
var total =0;
for(var i = 0; i<val.length; i++){
total = flt(total)+flt(val[i].score_earned)
}
doc.total_score = flt(total)
refresh_field('total_score')
}
/*cur_frm.cscript['Declare Completed'] = function(doc,cdt,cdn){
$c_obj(make_doclist(doc.doctype, doc.name),'declare_completed','', function(r,rt){
if(r.message){
refresh_field('Status');
cur_frm.cscript.refresh(doc,cdt,cdn);
}
});
}*/
cur_frm.cscript['Declare Completed'] = function(doc,cdt,cdn){
var declare_completed_dialog;
set_declare_completed_dialog = function() {
declare_completed_dialog = new Dialog(400, 200, 'Declare Completed');
declare_completed_dialog.make_body([
['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after declaring this Appraisal as completed. Are you sure, you want to declare it as completed ?</div>'],
['HTML', 'Response', '<div class = "comment" id="declare_completed_dialog_response"></div>'],
['HTML', 'Declare Completed', '<div></div>']
]);
var declare_completed_btn1 = $a($i(declare_completed_dialog.widgets['Declare Completed']), 'button', 'button');
declare_completed_btn1.innerHTML = 'Yes';
declare_completed_btn1.onclick = function(){ declare_completed_dialog.add(); }
var declare_completed_btn2 = $a($i(declare_completed_dialog.widgets['Declare Completed']), 'button', 'button');
declare_completed_btn2.innerHTML = 'No';
$y(declare_completed_btn2,{marginLeft:'4px'});
declare_completed_btn2.onclick = function(){ declare_completed_dialog.hide();}
declare_completed_dialog.onshow = function() {
$i('declare_completed_dialog_response').innerHTML = '';
}
declare_completed_dialog.refresh_dt = function(){
cur_frm.cscript.refresh(this.doc, this.cdt, this.cdn);
msgprint("refersh done");
$c('webnotes.widgets.form.form_header.refresh_labels',this.doc,function(r,rt){});
}
declare_completed_dialog.add = function() {
// sending...
$i('declare_completed_dialog_response').innerHTML = 'Processing...';
var m_arg = user+ '~~' + this.msg_nm_lst;
$c_obj(make_doclist(this.doc.doctype, this.doc.name),'declare_completed','', function(r,rt){
if(r.message.status == 'Completed'){
$i('declare_completed_dialog_response').innerHTML = 'Done';
refresh_field('status');
declare_completed_dialog.refresh_dt();
hide_field(['Update', 'Declare Completed', 'Calculate Total Score']);
declare_completed_dialog.hide();
}
else if(r.message.status == 'Incomplete'){
$i('declare_completed_dialog_response').innerHTML = 'Incomplete Appraisal';
}
else if(r.message.status == 'No Score'){
$i('declare_completed_dialog_response').innerHTML = 'Calculate total score';
}
});
}
}
if(!declare_completed_dialog){
set_declare_completed_dialog();
}
declare_completed_dialog.doc = doc;
declare_completed_dialog.cdt = cdt;
declare_completed_dialog.cdn = cdn;
declare_completed_dialog.show();
}
cur_frm.cscript.score = function(doc,cdt,cdn){
var d = locals[cdt][cdn];
if (d.score){
total = flt(d.per_weightage*d.score)/100;
d.score_earned = total.toPrecision(2);
refresh_field('score_earned', d.name, 'appraisal_details');
}
else{
d.score_earned = '';
refresh_field('score_earned', d.name, 'appraisal_details');
}
cur_frm.cscript.calculate_total(doc,cdt,cdn);
}
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
var val = getchildren('Appraisal Detail', doc.name, 'appraisal_details', doc.doctype);
var total =0;
for(var i = 0; i<val.length; i++){
total = flt(total)+flt(val[i].score_earned);
}
doc.total_score = flt(total);
refresh_field('total_score');
}

View File

@@ -0,0 +1,147 @@
# 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:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def get_employee_name(self):
emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
emp_nm= emp_nm and emp_nm[0][0] or ''
self.doc.employee_name = emp_nm
return cstr(emp_nm)
def fetch_kra(self):
if not self.doc.kra_template:
msgprint("Please select KRA Template to be be fetched")
raise Exception
self.doc.clear_table(self.doclist,'appraisal_details')
get_obj('DocType Mapper', 'KRA Template-Appraisal').dt_map('KRA Template', 'Appraisal', self.doc.kra_template, self.doc, self.doclist, "[['KRA Template','Appraisal'],['KRA Sheet', 'Appraisal Detail']]")
def validate_dates(self):
if getdate(self.doc.start_date) > getdate(self.doc.end_date):
msgprint("End Date can not be less than Start Date")
raise Exception
def validate_existing_appraisal(self):
chk = sql("select name from `tabAppraisal` where employee=%s and (status='Submitted' or status='Completed') and ((start_date>=%s and start_date<=%s) or (end_date>=%s and end_date<=%s))",(self.doc.employee,self.doc.start_date,self.doc.end_date,self.doc.start_date,self.doc.end_date))
if chk:
msgprint("You have already created Appraisal "+cstr(chk[0][0])+" in the current date range for employee "+cstr(self.doc.employee_name))
raise Exception
def validate_curr_appraisal(self):
for d in getlist(self.doclist, 'appraisal_details'):
if d.target_achieved or d.score:
if self.doc.status == 'Draft':
msgprint("Target achieved or Score can be added only for submitted Appraisal")
raise Exception
elif self.doc.status == 'Submitted' and session['user'] != self.doc.kra_approver:
msgprint("Target achieved or Score can be added only by Appraisal Approver")
raise Exception
def validate_fiscal_year(self):
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
ysd=fy and fy[0][0] or ""
yed=add_days(str(ysd),365)
if str(self.doc.start_date) < str(ysd) or str(self.doc.start_date) > str(yed) or str(self.doc.end_date) < str(ysd) or str(self.doc.end_date) > str(yed):
msgprint("Appraisal date range is not within the Fiscal Year selected")
raise Exception
def validate(self):
self.validate_dates()
self.validate_existing_appraisal()
self.validate_curr_appraisal()
self.validate_fiscal_year()
def set_approver(self):
ret={}
approver_lst =[]
emp_nm = self.get_employee_name()
approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self)
if approver_lst1:
approver_lst=approver_lst1
else:
approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")]
ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)}
return ret
def calculate_total(self):
total = 0
for d in getlist(self.doclist, 'appraisal_details'):
if d.score:
total = total + flt(d.score_earned)
ret={'total_score':flt(total)}
return cstr(ret)
def declare_completed(self):
ret={}
for d in getlist(self.doclist, 'appraisal_details'):
if not d.target_achieved or not d.score or not d.score_earned:
msgprint("Please add 'Target Achieved' and 'Score' for all KPI")
ret = {'status':'Incomplete'}
return ret
if not self.doc.total_score:
msgprint("Please calculate total score using button 'Calculate Total Score'")
ret = {'status':'No Score'}
return ret
self.update_appraisal()
#set(self.doc, 'status', 'Completed')
ret = {'status':'Completed'}
return ret
def update_appraisal(self):
for d in getlist(self.doclist, 'appraisal_details'):
if not d.kra or not d.per_weightage:
msgprint("Please remove the extra blank row added")
raise Exception
d.save()
if self.doc.total_score:
set(self.doc,'total_score',self.doc.total_score)
def on_update(self):
set(self.doc, 'status', 'Draft')
def validate_total_weightage(self):
total_w = 0
for d in getlist(self.doclist, 'appraisal_details'):
total_w = flt(total_w) + flt(d.per_weightage)
if flt(total_w)>100 or flt(total_w)<100:
msgprint("Total of weightage assigned to KPI is "+cstr(total_w)+".It should be 100(%)")
raise Exception
def validate_appraisal_detail(self):
if not self.doc.kra_approver:
msgprint("Please mention the name of Approver")
raise Exception
if not getlist(self.doclist, 'appraisal_details'):
msgprint("Please add KRA Details")
raise Exception
self.validate_total_weightage()
def on_submit(self):
self.validate_appraisal_detail()
set(self.doc, 'status', 'Submitted')
def on_cancel(self):
set(self.doc, 'status', 'Cancelled')

View File

@@ -0,0 +1,962 @@
[
{
'_last_update': None,
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': None,
'autoname': 'APRSL.#####',
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2010-09-01 15:47:54',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': None,
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2010-09-20 14:06:57',
'modified_by': 'Administrator',
'module': 'Payroll',
'name': 'Appraisal',
'name_case': '',
'owner': 'ashwini@webnotestech.com',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': '',
'read_only': None,
'read_only_onload': None,
'search_fields': 'status, employee, employee_name',
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': None,
'smallicon': None,
'subject': '',
'tag_fields': '',
'use_template': None,
'version': 159
},
{
'amend': 1,
'cancel': 1,
'create': 1,
'creation': '2010-09-01 15:47:54',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 1,
'match': None,
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'PERM00658',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Administrator',
'submit': 1,
'write': 1
},
{
'amend': None,
'cancel': None,
'create': None,
'creation': '2010-09-01 15:47:54',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 2,
'match': None,
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'PERM00659',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'Administrator',
'submit': None,
'write': None
},
{
'amend': 1,
'cancel': 1,
'create': 1,
'creation': '2010-09-01 15:47:54',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 3,
'match': None,
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'PERM00660',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'submit': 1,
'write': 1
},
{
'amend': None,
'cancel': None,
'create': None,
'creation': '2010-09-01 15:47:54',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 4,
'match': None,
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'PERM00661',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'System Manager',
'submit': None,
'write': None
},
{
'amend': 1,
'cancel': 1,
'create': 1,
'creation': '2010-09-01 15:47:54',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 5,
'match': None,
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'PERM00662',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'HR Manager',
'submit': 1,
'write': 1
},
{
'amend': 1,
'cancel': 1,
'create': 1,
'creation': '2010-09-01 15:47:54',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 6,
'match': None,
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'PERM00663',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'HR User',
'submit': 1,
'write': 1
},
{
'amend': None,
'cancel': None,
'create': None,
'creation': '2010-09-01 15:47:54',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 7,
'match': None,
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'PERM00664',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'HR Manager',
'submit': None,
'write': None
},
{
'amend': None,
'cancel': None,
'create': None,
'creation': '2010-09-01 15:47:54',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 8,
'match': None,
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'PERM00665',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'HR User',
'submit': None,
'write': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Employee Details',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03790',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Section Break',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-09-01 15:47:54',
'default': 'Draft',
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'status',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': 1,
'label': 'Status',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03791',
'no_column': None,
'no_copy': None,
'oldfieldname': 'status',
'oldfieldtype': 'Select',
'options': '\nDraft\nSubmitted\nCompleted\nCancelled',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': 1,
'trigger': '',
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'employee',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': 1,
'label': 'Employee',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03792',
'no_column': None,
'no_copy': None,
'oldfieldname': 'employee',
'oldfieldtype': 'Link',
'options': 'Employee',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': 1,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'employee_name',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': 1,
'label': 'Employee Name',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03793',
'no_column': None,
'no_copy': None,
'oldfieldname': 'employee_name',
'oldfieldtype': 'Data',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 5,
'in_filter': 1,
'label': 'Fiscal Year',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03794',
'no_column': None,
'no_copy': None,
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Select',
'options': 'link:Fiscal Year',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 6,
'in_filter': 1,
'label': 'Company',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03795',
'no_column': None,
'no_copy': None,
'oldfieldname': 'company',
'oldfieldtype': 'Link',
'options': 'Company',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Column Break',
'hidden': None,
'icon': None,
'idx': 7,
'in_filter': None,
'label': '',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03796',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Column Break',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '50%'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'start_date',
'fieldtype': 'Date',
'hidden': None,
'icon': None,
'idx': 8,
'in_filter': 1,
'label': 'Start Date',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03797',
'no_column': None,
'no_copy': None,
'oldfieldname': 'start_date',
'oldfieldtype': 'Date',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'end_date',
'fieldtype': 'Date',
'hidden': None,
'icon': None,
'idx': 9,
'in_filter': 1,
'label': 'End Date',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03798',
'no_column': None,
'no_copy': None,
'oldfieldname': 'end_date',
'oldfieldtype': 'Date',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'kra_approver',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 10,
'in_filter': 0,
'label': 'Approver',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03799',
'no_column': None,
'no_copy': None,
'oldfieldname': 'kra_approver',
'oldfieldtype': 'Select',
'options': '',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Data',
'hidden': 1,
'icon': None,
'idx': 11,
'in_filter': None,
'label': 'Amended From',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03800',
'no_column': None,
'no_copy': 1,
'oldfieldname': 'amended_from',
'oldfieldtype': 'Data',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '150px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'hidden': 1,
'icon': None,
'idx': 12,
'in_filter': None,
'label': 'Amendment Date',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03801',
'no_column': None,
'no_copy': 1,
'oldfieldname': 'amendment_date',
'oldfieldtype': 'Date',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '160px'
},
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': None,
'icon': None,
'idx': 13,
'in_filter': None,
'label': 'Declare Completed',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03802',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Button',
'options': '',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 14,
'in_filter': None,
'label': '',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03803',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Section Break',
'options': 'Simple',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': 'Select template from which you want to fetch KRA',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'kra_template',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 15,
'in_filter': None,
'label': 'KRA Template',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03804',
'no_column': None,
'no_copy': None,
'oldfieldname': 'kra_template',
'oldfieldtype': 'Link',
'options': 'KRA Template',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': '',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': None,
'icon': None,
'idx': 16,
'in_filter': None,
'label': 'Fetch Template',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03805',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Button',
'options': 'fetch_kra',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': 1,
'icon': None,
'idx': 17,
'in_filter': None,
'label': 'Update',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03806',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Button',
'options': '',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'appraisal_details',
'fieldtype': 'Table',
'hidden': None,
'icon': None,
'idx': 18,
'in_filter': None,
'label': 'Appraisal Details',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03807',
'no_column': None,
'no_copy': None,
'oldfieldname': 'appraisal_details',
'oldfieldtype': 'Table',
'options': 'Appraisal Detail',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': '',
'width': None
},
{
'allow_on_submit': 1,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': None,
'icon': None,
'idx': 19,
'in_filter': None,
'label': 'Calculate Total Score',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03808',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Button',
'options': 'calculate_total',
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-01 15:47:54',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'total_score',
'fieldtype': 'Currency',
'hidden': None,
'icon': None,
'idx': 20,
'in_filter': None,
'label': 'Total Score',
'modified': '2010-09-01 15:47:54',
'modified_by': 'Administrator',
'name': 'FL03809',
'no_column': None,
'no_copy': 1,
'oldfieldname': 'total_score',
'oldfieldtype': 'Currency',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Appraisal',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
}
]

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-30 15:44:06', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'ashwini@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 13, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'APRSLD.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': None, 'name': 'Appraisal Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-30 15:44:06', 'doctype': 'DocField', 'oldfieldname': 'kra', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'KRA', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Key Responsibility Area', 'parent': 'Appraisal Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06074', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-01 15:02:52', 'parenttype': 'DocType', 'fieldname': 'kra', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-08-30 15:44:06', 'doctype': 'DocField', 'oldfieldname': 'per_weightage', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Weightage (%)', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Appraisal Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06075', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-01 15:02:52', 'parenttype': 'DocType', 'fieldname': 'per_weightage', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Small Text', 'creation': '2010-08-30 15:44:06', 'doctype': 'DocField', 'oldfieldname': 'target_achieved', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Target Achieved', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Appraisal Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL06076', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-01 15:02:52', 'parenttype': 'DocType', 'fieldname': 'target_achieved', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Select', 'creation': '2010-08-30 15:44:06', 'doctype': 'DocField', 'oldfieldname': 'score', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Score (0-5)', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Appraisal Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL06077', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-01 15:02:52', 'parenttype': 'DocType', 'fieldname': 'score', 'fieldtype': 'Select', 'options': '\n0\n1\n2\n3\n4\n5', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2010-08-30 15:44:06', 'doctype': 'DocField', 'oldfieldname': 'score_earned', 'owner': 'ashwini@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Score Earned', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Appraisal Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06078', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-01 15:02:52', 'parenttype': 'DocType', 'fieldname': 'score_earned', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1,12 @@
//get employee's name based on employee id selected
cur_frm.cscript.employee = function(doc,cdt,cdn){
if(doc.employee) get_server_fields('get_emp_name', '', '', doc, cdt, cdn, 1);
refresh_field('employee_name');
}
//Employee
//-----------------------------
cur_frm.fields_dict['employee'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabEmployee`.`name` FROM `tabEmployee` WHERE `tabEmployee`.status = "Active" AND `tabEmployee`.`docstatus`!= 2 AND `tabEmployee`.%(key)s LIKE "%s" ORDER BY `tabEmployee`.`name` ASC LIMIT 50';
}

View File

@@ -0,0 +1,133 @@
# 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:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
# Notification objects
self.badge_obj = get_obj('Badge Settings','Badge Settings','','',1)
#autoname function
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
#get employee name based on employee id selected
def get_emp_name(self):
emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
#this is done because sometimes user entered wrong employee name while uploading employee attendance
set(self.doc, 'employee_name', emp_nm and emp_nm[0][0] or '')
ret = { 'employee_name' : emp_nm and emp_nm[0][0] or ''}
return str(ret)
#validation for duplicate record
def validate_duplicate_record(self):
res = sql("select name from `tabAttendance` where employee = '%s' and att_date = '%s' and not name = '%s' and docstatus = 1"%(self.doc.employee,self.doc.att_date, self.doc.name))
if res:
msgprint("Employee's attendance already marked.")
raise Exception
#validation - leave_type is mandatory for status absent/ half day else not required to entered.
def validate_status(self):
if self.doc.status == 'Present' and self.doc.leave_type:
msgprint("You can not enter leave type for attendance status 'Present'")
raise Exception
elif (self.doc.status == 'Absent' or self.doc.status == 'Half Day') and not self.doc.leave_type:
msgprint("Please enter leave type for attendance status 'Absent'")
raise Exception
#check for already record present in leave transaction for same date
def check_leave_record(self):
if self.doc.status == 'Present':
chk = sql("select name from `tabLeave Transaction` where employee=%s and (from_date <= %s and to_date >= %s) and status = 'Submitted' and leave_transaction_type = 'Deduction' and docstatus!=2", (self.doc.employee, self.doc.att_date, self.doc.att_date))
if chk:
msgprint("Leave Application created for employee "+self.doc.employee+" whom you are trying to mark as 'Present' ")
raise Exception
#For absent/ half day record - check for leave balances of the employees
def validate_leave_type(self):
if not self.doc.status =='Present' and self.doc.leave_type not in ('Leave Without Pay','Compensatory Off'):
#check for leave allocated to employee from leave transaction
ret = sql("select name from `tabLeave Transaction` where employee = '%s' and leave_type = '%s' and leave_transaction_type = 'Allocation' and fiscal_year = '%s'"%(self.doc.employee,self.doc.leave_type,self.doc.fiscal_year))
#if leave allocation is present then calculate leave balance i.e. sum(allocation) - sum(deduction)
if ret:
q1 = 'SUM(CASE WHEN leave_transaction_type = "Allocation" THEN total_leave ELSE 0 END)-SUM(CASE WHEN leave_transaction_type = "Deduction" THEN total_leave ELSE 0 END)'
q2 = "select %s from `tabLeave Transaction` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1"
res = sql(q2%(q1,self.doc.employee,self.doc.leave_type,self.doc.fiscal_year))
if res:
if self.doc.status == 'Absent' and flt(res[0][0]) < 1:
msgprint("%s balances are insufficient to cover a day absence, please select other leave type."%self.doc.leave_type)
raise Exception
if self.doc.status == 'Half Day' and flt(res[0][0]) < 0.5:
msgprint("%s balances are insufficient to cover a half day absence, please select other leave type."%self.doc.leave_type)
raise Exception
else:
msgprint("Leave Allocation for employee %s not done.\n You can allocate leaves from HR -> Leave Transaction OR HR -> Leave Control Panel."%self.doc.employee)
raise Exception
def validate_fiscal_year(self):
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"% self.doc.fiscal_year)
ysd=fy and fy[0][0] or ""
yed=add_days(str(ysd),365)
if str(self.doc.att_date) < str(ysd) or str(self.doc.att_date) > str(yed):
msgprint("'%s' Not Within The Fiscal Year selected"%(self.doc.att_date))
raise Exception
def validate_att_date(self):
import datetime
if getdate(self.doc.att_date)>getdate(datetime.datetime.now().date().strftime('%Y-%m-%d')):
msgprint("Attendance can not be marked for future dates")
raise Exception
# Validate employee
#-------------------
def validate_employee(self):
emp = sql("select name, status from `tabEmployee` where name = '%s'" % self.doc.employee)
if not emp:
msgprint("Employee: %s does not exists in the system" % self.doc.employee, raise_exception=1)
elif emp[0][1] != 'Active':
msgprint("Employee: %s is not Active" % self.doc.employee, raise_exception=1)
# validate...
def validate(self):
self.validate_fiscal_year()
self.validate_att_date()
#self.validate_leave_type()
self.validate_duplicate_record()
#self.validate_status()
self.check_leave_record()
def on_update(self):
#self.validate()
#this is done because sometimes user entered wrong employee name while uploading employee attendance
x=self.get_emp_name()
def on_submit(self):
#this is done because while uploading attendance chnage docstatus to 1 i.e. submit
set(self.doc,'docstatus',1)
pass

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,50 @@
cur_frm.cscript.onload = function(doc,cdt,cdn){
cur_frm.log_div = $a(cur_frm.fields_dict['Import Log1'].wrapper,'div','',{border:'1px solid #CCC', backgroundColor:'#DDD',width : '100%', height : '300px', overflow : 'auto'});
hide_field('Import Log1')
doc.att_fr_date = get_today();
doc.file_list = '';
doc.overwrite = 0;
refresh_many(['att_fr_date','file_list','overwrite']);
}
//download attendance template - csv file
cur_frm.cscript['Get Template'] = function(doc,cdt,cdn){
if(doc.att_to_date && !doc.att_fr_date)
alert("Please enter 'Attendance To Date'");
else if(doc.att_to_date && doc.att_fr_date && doc.att_to_date < doc.att_fr_date)
alert("Attendance to date cannot be less than from date.");
else
$c_obj_csv(make_doclist(cdt,cdn),'get_att_list','');
}
//---------------------------------------------------------
cur_frm.cscript['Import'] = function(doc,cdt,cdn){
if(!doc.file_list){
alert("Please upload attendance data CSV file");
}
else{
var call_back = function(r,rt){
cur_frm.log_div.innerHTML = '';
if(r.message)
cur_frm.log_div.innerHTML = r.message;
cur_frm.cscript.refresh(doc,cdt,cdn);
}
$c_obj(make_doclist(cdt,cdn),'import_att_data','',call_back);
}
cur_frm.cscript.refresh(doc,cdt,cdn);
}
//====================================================
cur_frm.cscript.refresh = function(doc,cdt,cdn){
if(cur_frm.log_div.innerHTML == '')
hide_field('Import Log1');
else
unhide_field('Import Log1');
refresh_field('Import Log1');
}

View File

@@ -0,0 +1,105 @@
# 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:
def __init__(self,d,dt):
self.doc, self.doclist = d,dt
#==========================================================================
def get_att_list(self):
lst = [['Attendance','','','Please fill columns which are Mandatory.',' Please do not modify the structure','',''],['','','','','','',''],['[Mandatory]','','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]'],['Employee','Employee Name','Attendance Date','Status','Fiscal Year','Company','Naming Series']]
dt = self.date_diff_list() # get date list inbetween from date and to date
att_dt = self.get_att_data() # get default attendance data like fiscal yr, company, naming series
fy, comp, sr = att_dt['fy'], att_dt['comp'], att_dt['sr']
res = sql("select name, employee_name from `tabEmployee` where status = 'Active' and docstatus !=2")
for d in dt:
for r in res:
lst.append([r[0],r[1],d,'',fy,comp,sr])
return lst
#------------------------------------------------------------------------------
# get date list inbetween from date and to date
def date_diff_list(self):
import datetime
#get from date
att_fr_date = self.doc.att_fr_date and self.doc.att_fr_date or ''
#get to date
att_to_date = self.doc.att_to_date and self.doc.att_to_date or ''
if att_to_date:
r = (getdate(self.doc.att_to_date)+datetime.timedelta(days=1)-getdate(self.doc.att_fr_date)).days
else:
r = 1
dateList = [getdate(self.doc.att_fr_date)+datetime.timedelta(days=i) for i in range(0,r)]
dt=([str(date) for date in dateList])
return dt
#------------------------------------------------------------------------------
def get_att_data(self):
fy = get_defaults()['fiscal_year'] #get default fiscal year
comp = get_defaults()['company'] #get default company
#get naming series of attendance
#sr = sql("select series_options from `tabNaming Series Options` where doc_type='Attendance'")
sr = sql("select options from `tabDocField` where parent = 'Attendance' and fieldname = 'naming_series'")
if not sr:
msgprint("Please create naming series for Attendance.\nGo to Setup--> Manage Series.")
raise Exception
else:
sr = sr and sr[0][0]
return {'fy':fy,'comp':comp,'sr':sr}
#=================================================================================
def import_att_data(self):
filename = self.doc.file_list.split(',')
if not filename:
msgprint("Please attach a .CSV File.")
raise Exception
if filename[0].find('.csv') < 0:
raise Exception
if not filename and filename[0] and file[1]:
msgprint("Please Attach File. ")
raise Exception
from webnotes.utils import file_manager
fn, content = file_manager.get_file(filename[1])
if not type(content) == str:
content = content.tostring()
import webnotes.model.import_docs
im = webnotes.model.import_docs.CSVImport()
out = im.import_csv(content,self.doc.import_date_format, cint(self.doc.overwrite))
return out

File diff suppressed because one or more lines are too long

View File

View File

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:39', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 12, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:branch', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Branch', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00710', 'parent': 'Branch', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:39', 'modified': '2010-09-20 08:57:23', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00797', 'parent': 'Branch', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:54:14', 'modified': '2010-09-20 08:57:23', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00798', 'parent': 'Branch', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:54:14', 'modified': '2010-09-20 08:57:23', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Branch', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04827', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:23', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:39', 'doctype': 'DocField', 'oldfieldname': 'branch', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Branch', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Branch', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04177', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 08:57:23', 'parenttype': 'DocType', 'fieldname': 'branch', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

File diff suppressed because one or more lines are too long

View File

View File

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:40', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 9, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:city_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'City', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00713', 'parent': 'City', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:40', 'modified': '2010-09-20 09:04:30', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00789', 'parent': 'City', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:52:11', 'modified': '2010-09-20 09:04:30', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00790', 'parent': 'City', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:52:11', 'modified': '2010-09-20 09:04:30', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'City', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04831', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:04:30', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'city_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'City Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'City', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04184', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:04:30', 'parenttype': 'DocType', 'fieldname': 'city_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'state', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'State', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'City', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04185', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-20 09:04:30', 'parenttype': 'DocType', 'fieldname': 'state', 'fieldtype': 'Link', 'options': 'State', 'report_hide': None, 'parentfield': 'fields'}]

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:40', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 16, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Condition Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00714', 'parent': 'Condition Detail', 'read': 1, 'create': None, 'creation': '2010-04-01 14:14:40', 'modified': '2010-04-01 15:02:27', 'submit': None, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'All', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'rule_master', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Form', 'width': None, 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Condition Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04198', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:02:27', 'parenttype': 'DocType', 'fieldname': 'rule_master', 'fieldtype': 'Link', 'options': 'DocType', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'rule_field', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Field', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Condition Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04199', 'idx': 2, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:02:27', 'parenttype': 'DocType', 'fieldname': 'rule_field', 'fieldtype': 'Select', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'operator', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Operator', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Condition Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04200', 'idx': 3, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:02:27', 'parenttype': 'DocType', 'fieldname': 'operator', 'fieldtype': 'Select', 'options': '\nEquals\nNot Equals\nGreater than\nGreater than or Equals\nLess than\nLess than or Equals', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:40', 'doctype': 'DocField', 'oldfieldname': 'value', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Value', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Condition Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04201', 'idx': 4, 'default': None, 'colour': 'White:FFF', 'modified': '2010-04-01 15:02:27', 'parenttype': 'DocType', 'fieldname': 'value', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,160 @@
[
{
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': None,
'autoname': None,
'change_log': None,
'client_script': None,
'client_script_core': '',
'client_string': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:08:57',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': None,
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': 1,
'max_attachments': None,
'menu_index': None,
'modified': '2010-11-02 20:44:58',
'modified_by': 'sneha@webnotestech.com',
'module': 'Payroll',
'name': 'Deduction Detail',
'name_case': '',
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': '',
'read_only': None,
'read_only_onload': None,
'search_fields': None,
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': '',
'server_code_error': ' ',
'show_in_menu': 0,
'smallicon': None,
'use_template': None,
'version': 14
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:57',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'd_type',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Type',
'modified': '2010-08-08 17:08:57',
'modified_by': 'Administrator',
'name': 'FL00900',
'no_copy': None,
'oldfieldname': 'd_type',
'oldfieldtype': 'Select',
'options': 'Deduction Type',
'owner': 'Administrator',
'parent': 'Deduction Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': '200px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:57',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'd_modified_amt',
'fieldtype': 'Currency',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': None,
'label': 'Amount',
'modified': '2010-08-08 17:08:57',
'modified_by': 'Administrator',
'name': 'FL00902',
'no_copy': None,
'oldfieldname': 'd_modified_amt',
'oldfieldtype': 'Currency',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Deduction Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': ''
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:57',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'depend_on_lwp',
'fieldtype': 'Check',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': None,
'label': 'Depend on LWP',
'modified': '2010-08-08 17:08:57',
'modified_by': 'Administrator',
'name': 'FL00903',
'no_copy': None,
'oldfieldname': 'depend_on_lwp',
'oldfieldtype': 'Check',
'options': None,
'owner': 'Administrator',
'parent': 'Deduction Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
}
]

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:40', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': 1, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 13, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:deduction_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': 'Master', 'name': 'Deduction Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-12 17:19:47', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00719', 'parent': 'Deduction Type', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:41', 'modified': '2010-10-12 17:19:47', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00803', 'parent': 'Deduction Type', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:55:37', 'modified': '2010-10-12 17:19:47', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'harshada@webnotestech.com', 'name': 'PERM00804', 'parent': 'Deduction Type', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:55:37', 'modified': '2010-10-12 17:19:47', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Deduction Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04838', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-10-12 17:19:47', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'deduction_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Deduction Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04212', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-10-12 17:19:47', 'parenttype': 'DocType', 'fieldname': 'deduction_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'harshada@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Deduction Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04213', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-10-12 17:19:47', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:41', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:department_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Department', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00720', 'parent': 'Department', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:41', 'modified': '2010-09-20 09:24:25', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00793', 'parent': 'Department', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:53:18', 'modified': '2010-09-20 09:24:25', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00794', 'parent': 'Department', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:53:18', 'modified': '2010-09-20 09:24:25', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Department', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04839', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:24:25', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'department_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Department', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Department', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04215', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:24:25', 'parenttype': 'DocType', 'fieldname': 'department_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:41', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:designation_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Designation', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00721', 'parent': 'Designation', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:41', 'modified': '2010-09-20 09:24:40', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00795', 'parent': 'Designation', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:53:48', 'modified': '2010-09-20 09:24:40', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00796', 'parent': 'Designation', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:53:48', 'modified': '2010-09-20 09:24:40', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Designation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04840', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:24:40', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:41', 'doctype': 'DocField', 'oldfieldname': 'designation_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Designation', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Designation', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04216', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:24:40', 'parenttype': 'DocType', 'fieldname': 'designation_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,160 @@
[
{
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': None,
'autoname': None,
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:08:59',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': None,
'dt_template': None,
'hide_heading': 0,
'hide_toolbar': 0,
'idx': None,
'in_create': None,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': 1,
'max_attachments': None,
'menu_index': None,
'modified': '2011-02-09 13:02:55',
'modified_by': 'Administrator',
'module': 'Payroll',
'name': 'Earning Detail',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': None,
'read_only_onload': None,
'search_fields': None,
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': 0,
'smallicon': None,
'use_template': None,
'version': 28
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:59',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'e_type',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Type',
'modified': '2011-02-09 13:02:55',
'modified_by': 'Administrator',
'name': 'FL01069',
'no_copy': None,
'oldfieldname': 'e_type',
'oldfieldtype': 'Data',
'options': 'Earning Type',
'owner': 'Administrator',
'parent': 'Earning Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': '200px'
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:08:59',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'modified_value',
'fieldtype': 'Currency',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': None,
'label': 'Amount',
'modified': '2011-02-09 13:02:55',
'modified_by': 'Administrator',
'name': 'FL01071',
'no_copy': None,
'oldfieldname': 'modified_value',
'oldfieldtype': 'Currency',
'options': None,
'owner': 'Administrator',
'parent': 'Earning Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': ''
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:59',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'depend_on_lwp',
'fieldtype': 'Check',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': None,
'label': 'Depend on LWP',
'modified': '2011-02-09 13:02:55',
'modified_by': 'Administrator',
'name': 'FL01072',
'no_copy': None,
'oldfieldname': 'depend_on_lwp',
'oldfieldtype': 'Check',
'options': None,
'owner': 'Administrator',
'parent': 'Earning Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
}
]

View File

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,51 @@
// get retirement date
//========================================================
cur_frm.cscript.date_of_birth = function(doc, dt, dn) {
get_server_fields('get_retirement_date','','',doc,dt,dn,1);
}
// salutation-gender
//========================================================
cur_frm.cscript.salutation = function(doc,dt,dn) {
if(doc.salutation){
if(doc.salutation=='Mr')
doc.gender='Male';
else if(doc.salutation=='Ms')
doc.gender='Female';
refresh_field('gender');
}
}
// On refresh
//========================================================
cur_frm.cscript.refresh = function(doc, dt, dn) {
if(doc.__islocal!=1){
cur_frm.add_custom_button('Make Salary Structure', cur_frm.cscript['Make Salary Structure']);
}
}
//Make Salary Structure
//========================================================
cur_frm.cscript['Make Salary Structure']=function(){
$c_obj(make_doclist (doc.doctype,doc.name),'check_sal_structure',cur_frm.doc.name,function(r, rt) {
if(r.message)
alert("You have already created Active salary structure.\nIf you want to create new one, please ensure that no active salary structure exist.\nTo inactive salary structure select 'Is Active' as 'No'.");
else
cur_frm.cscript.make_salary_structure(cur_frm.doc);
});
}
// Load sal structure
//========================================================
cur_frm.cscript.make_salary_structure = function(doc,dt,dn,det){
var st = LocalDB.create('Salary Structure');
st = locals['Salary Structure'][st];
st.employee = doc.name;
st.employee_name = doc.employee_name;
st.branch=doc.branch;
st.designation=doc.designation;
st.department=doc.department;
st.fiscal_year = doc.fiscal_year
st.grade=doc.grade;
loaddoc('Salary Structure', st.name);
}

View File

@@ -0,0 +1,118 @@
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
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:
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
# Autoname
#========================================================================================================
def autoname(self):
ret = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'emp_created_by'")
if not ret:
msgprint("To Save Employee, please go to Setup -->Global Defaults. Click on HR and select 'Employee Records to be created by'.")
raise Exception
else:
if ret[0][0]=='Naming Series':
self.doc.name = make_autoname(self.doc.naming_series + '.####')
elif ret[0][0]=='Employee Number':
self.doc.name = make_autoname(self.doc.employee_number)
# Get retirement date
#========================================================================================================
def get_retirement_date(self):
import datetime
ret = {}
if self.doc.date_of_birth:
dt = getdate(self.doc.date_of_birth) + datetime.timedelta(21915)
ret = {'date_of_retirement': dt.strftime('%Y-%m-%d')}
return str(ret)
# check if salary structure exists
#========================================================================================================
def check_sal_structure(self, nm):
ret_sal_struct=sql("select name from `tabSalary Structure` where employee='%s' and is_active = 'Yes'"%nm)
return ret_sal_struct and ret_sal_struct[0][0] or ''
#========================================================================================================
def validate(self):
self.validate_date()
self.validate_email()
self.validate_name()
self.validate_status()
# Validate dates
#========================================================================================================
def validate_date(self):
import datetime
if self.doc.date_of_birth and self.doc.date_of_joining and getdate(self.doc.date_of_birth) >= getdate(self.doc.date_of_joining):
msgprint('Date of Joining must be greater than Date of Birth')
raise Exception
elif self.doc.scheduled_confirmation_date and self.doc.date_of_joining and (getdate(self.doc.scheduled_confirmation_date) < getdate(self.doc.date_of_joining)):
msgprint('Scheduled Confirmation Date must be greater than Date of Joining')
raise Exception
elif self.doc.final_confirmation_date and self.doc.date_of_joining and (getdate(self.doc.final_confirmation_date) < getdate(self.doc.date_of_joining)):
msgprint('Final Confirmation Date must be greater than Date of Joining')
raise Exception
elif self.doc.date_of_retirement and self.doc.date_of_joining and (getdate(self.doc.date_of_retirement) <= getdate(self.doc.date_of_joining)):
msgprint('Date Of Retirement must be greater than Date of Joining')
raise Exception
elif self.doc.relieving_date and self.doc.date_of_joining and (getdate(self.doc.relieving_date) <= getdate(self.doc.date_of_joining)):
msgprint('Relieving Date must be greater than Date of Joining')
raise Exception
elif self.doc.contract_end_date and self.doc.date_of_joining and (getdate(self.doc.contract_end_date)<=getdate(self.doc.date_of_joining)):
msgprint('Contract End Date must be greater than Date of Joining')
raise Exception
# Validate email id
#========================================================================================================
def validate_email(self):
if self.doc.company_email and not validate_email_add(self.doc.company_email):
msgprint("Please enter valid Company Email")
raise Exception
if self.doc.personal_email and not validate_email_add(self.doc.personal_email):
msgprint("Please enter valid Personal Email")
raise Exception
# Validate name
#========================================================================================================
def validate_name(self):
ret = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = 'emp_created_by'")
if not ret:
msgprint("To Save Employee, please go to Setup -->Global Defaults. Click on HR and select 'Employee Records to be created by'.")
raise Exception
else:
if ret[0][0]=='Naming Series' and not self.doc.naming_series:
msgprint("Please select Naming Series.")
raise Exception
elif ret[0][0]=='Employee Number' and not self.doc.employee_number:
msgprint("Please enter Employee Number.")
raise Exception
# Validate status
#========================================================================================================
def validate_status(self):
if self.doc.status == 'Left' and not self.doc.relieving_date:
msgprint("Please enter relieving date.")
raise Exception

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
cur_frm.cscript.onload = function(doc, cdt, cdn){
$c('runserverobj', args={'method':'cal_tot_exp','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
function(r, rt) { refresh_many(['year','months']); });
}
//===========================================================
cur_frm.cscript.employee = function(doc, cdt, cdn){
$c('runserverobj', args={'method':'get_doj','docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
function(r, rt) { refresh_many(['employee_name','date_of_joining']); });
}
//===========================================================
cur_frm.cscript.country1 = function(doc, cdt, cdn) {
var mydoc=doc;
$c('runserverobj', args={'method':'check_state','arg':doc.country1, 'docs':compress_doclist([doc])},
function(r,rt){
if(r.message) {
var doc = locals[mydoc.doctype][mydoc.name];
doc.state1 = '';
get_field(doc.doctype, 'state1' , doc.name).options = r.message;
refresh_field('state1');
}
}
);
}
//===========================================================
cur_frm.cscript.country2 = function(doc, cdt, cdn) {
var mydoc=doc;
$c('runserverobj', args={'method':'check_state', 'arg':doc.country2,'docs':compress_doclist([doc])},
function(r,rt){
if(r.message) {
var doc = locals[mydoc.doctype][mydoc.name];
doc.state2 = '';
get_field(doc.doctype, 'state2' , doc.name).options = r.message;
refresh_field('state2');
}
}
);
}

View File

@@ -0,0 +1,73 @@
# 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('EMP-'+self.doc.employee)
#=============================================================
def validate(self):
if self.doc.personal_email:
if not validate_email_add(self.doc.personal_email):
msgprint("Please enter valid Personal Email")
raise Exception
ret = sql("select name from `tabEmployee Profile` where employee = '%s' and name !='%s'"%(self.doc.employee,self.doc.name))
if ret:
msgprint("Employee Profile is already created for Employee : '%s'"%self.doc.employee)
raise Exception
#=============================================================
def get_doj(self):
ret_doj = sql("select employee_name,date_of_joining from `tabEmployee` where name = '%s'"%self.doc.employee)
if ret_doj:
set(self.doc, 'employee_name', cstr(ret_doj[0][0]))
set(self.doc,'date_of_joining', ret_doj[0][1].strftime('%Y-%m-%d'))
#=============================================================
#calculate total experience in company - total year and month
def cal_tot_exp(self):
if not self.doc.date_of_joining:
self.get_doj()
import datetime
today = nowdate()
diff = (getdate(today) - getdate(self.doc.date_of_joining)).days
diff1 = cint(diff)/365
a = cint(diff)%365
diff2 = cint(a)/30
if(cint(diff1)<0):
set(self.doc,'year', 0)
else:
set(self.doc,'year', cint(diff1))
if(cint(diff1)<0):
set(self.doc,'months', 0)
else:
set(self.doc,'months', cint(diff2))
#=============================================================
def check_state(self,country):
return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " %country)])

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:44', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 18, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:employee_type_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Employment Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00730', 'parent': 'Employment Type', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:44', 'modified': '2010-09-20 09:38:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00807', 'parent': 'Employment Type', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:56:40', 'modified': '2010-09-20 09:38:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00808', 'parent': 'Employment Type', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:56:41', 'modified': '2010-09-20 09:38:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'employee_type_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Employment Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Employment Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04371', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:38:36', 'parenttype': 'DocType', 'fieldname': 'employee_type_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Employment Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04844', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:38:36', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-23 18:05:43', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:expense_type', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Expense Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01128', 'parent': 'Expense Type', 'read': 1, 'create': 1, 'creation': '2010-08-23 18:24:07', 'modified': '2010-09-20 09:39:02', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01129', 'parent': 'Expense Type', 'read': 1, 'create': 1, 'creation': '2010-08-23 18:24:07', 'modified': '2010-09-20 09:39:02', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM01159', 'parent': 'Expense Type', 'read': 1, 'create': 1, 'creation': '2010-09-03 10:46:22', 'modified': '2010-09-20 09:39:02', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'System Manager', 'owner': 'ashwini@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-08-23 18:05:43', 'doctype': 'DocField', 'oldfieldname': 'expense_type', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': 0, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Expense Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Type', 'search_index': 0, 'allow_on_submit': None, 'icon': None, 'name': 'FL05980', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:39:02', 'parenttype': 'DocType', 'fieldname': 'expense_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-23 18:05:43', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05981', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:39:02', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

@@ -0,0 +1,211 @@
cur_frm.cscript.onload = function(doc,cdt,cdn){
cur_frm.cscript.get_tips(doc, cdt, cdn);
if(!doc.approval_status) set_multiple(cdt,cdn,{approval_status:'Draft'});
if(doc.employee) cur_frm.cscript.employee(doc,cdt,cdn);
if (doc.__islocal) {
if(doc.amended_from) set_multiple(cdt,cdn,{approval_status:'Draft'});
var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
for(var i = 0; i<val.length; i++){
val[i].sanctioned_amount ='';
}
//doc.total_claimed_amount = '';
doc.total_sanctioned_amount = '';
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
}
}
cur_frm.cscript.refresh = function(doc,cdt,cdn){
if((user == doc.exp_approver && doc.approval_status == 'Submitted') || doc.docstatus == 0) unhide_field('Calculate Total Amount');
else hide_field('Calculate Total Amount');
if(user == doc.exp_approver && doc.approval_status == 'Submitted') unhide_field(['Update Voucher', 'Approve', 'Reject']);
else hide_field(['Update Voucher', 'Approve', 'Reject']);
if(user == doc.exp_approver && doc.approval_status == 'Submitted') set_field_permlevel('remark', 0);
else set_field_permlevel('remark', 1);
}
cur_frm.cscript.employee = function(doc,cdt,cdn){
if(doc.employee){
$c_obj(make_doclist(doc.doctype, doc.name),'set_approver','', function(r,rt){
if(r.message){
doc.employee_name = r.message['emp_nm'];
get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
refresh_many(['exp_approver','employee_name']);
}
});
}
}
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
if(doc.approval_status == 'Draft'){
var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
var total_claim =0;
for(var i = 0; i<val.length; i++){
total_claim = flt(total_claim)+flt(val[i].claim_amount);
}
doc.total_claimed_amount = flt(total_claim);
refresh_field('total_claimed_amount');
$c_obj(make_doclist(doc.doctype, doc.name),'validate_approver','', function(r,rt){
if(r.message){
if(r.message['valid_approver'] == 'No'){
doc.exp_approver ='';
}
get_field(doc.doctype, 'exp_approver' , doc.name).options = '';
get_field(doc.doctype, 'exp_approver' , doc.name).options = r.message['app_lst'];
refresh_field('exp_approver');
}
});
}
else if(doc.approval_status == 'Submitted'){
var val = getchildren('Expense Voucher Detail', doc.name, 'expense_voucher_details', doc.doctype);
var total_sanctioned = 0;
for(var i = 0; i<val.length; i++){
total_sanctioned = flt(total_sanctioned)+flt(val[i].sanctioned_amount);
}
doc.total_sanctioned_amount = flt(total_sanctioned);
refresh_field('total_sanctioned_amount');
}
}
cur_frm.cscript['Calculate Total Amount'] = function(doc,cdt,cdn){
cur_frm.cscript.calculate_total(doc,cdt,cdn);
}
cur_frm.cscript.claim_amount = function(doc,cdt,cdn){
cur_frm.cscript.calculate_total(doc,cdt,cdn);
}
cur_frm.cscript.sanctioned_amount = function(doc,cdt,cdn){
cur_frm.cscript.calculate_total(doc,cdt,cdn);
}
cur_frm.cscript['Approve'] = function(doc,cdt,cdn){
if(user == doc.exp_approver){
var approve_voucher_dialog;
set_approve_voucher_dialog = function() {
approve_voucher_dialog = new Dialog(400, 200, 'Approve Voucher');
approve_voucher_dialog.make_body([
['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after approving this expense voucher. Are you sure, you want to approve it ?</div>'],
['HTML', 'Response', '<div class = "comment" id="approve_voucher_dialog_response"></div>'],
['HTML', 'Approve Voucher', '<div></div>']
]);
var approve_voucher_btn1 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
approve_voucher_btn1.innerHTML = 'Yes';
approve_voucher_btn1.onclick = function(){ approve_voucher_dialog.add(); }
var approve_voucher_btn2 = $a($i(approve_voucher_dialog.widgets['Approve Voucher']), 'button', 'button');
approve_voucher_btn2.innerHTML = 'No';
$y(approve_voucher_btn2,{marginLeft:'4px'});
approve_voucher_btn2.onclick = function(){ approve_voucher_dialog.hide();}
approve_voucher_dialog.onshow = function() {
$i('approve_voucher_dialog_response').innerHTML = '';
}
approve_voucher_dialog.add = function() {
// sending...
$i('approve_voucher_dialog_response').innerHTML = 'Processing...';
$c_obj(make_doclist(this.doc.doctype, this.doc.name),'approve_voucher','', function(r,rt){
if(r.message == 'Approved'){
$i('approve_voucher_dialog_response').innerHTML = 'Approved';
refresh_field('approval_status');
hide_field(['Update Voucher', 'Approve', 'Reject', 'Calculate Total Amount']);
approve_voucher_dialog.hide();
}
else if(r.message == 'Incomplete'){
$i('approve_voucher_dialog_response').innerHTML = 'Incomplete Voucher';
}
else if(r.message == 'No Amount'){
$i('approve_voucher_dialog_response').innerHTML = 'Calculate total amount';
}
});
}
}
if(!approve_voucher_dialog){
set_approve_voucher_dialog();
}
approve_voucher_dialog.doc = doc;
approve_voucher_dialog.cdt = cdt;
approve_voucher_dialog.cdn = cdn;
approve_voucher_dialog.show();
refresh_field('expense_voucher_details');
doc.__unsaved = 0;
cur_frm.refresh_header();
}else{
msgprint("Expense Voucher can be approved by Approver only");
}
}
cur_frm.cscript['Reject'] = function(doc,cdt,cdn){
if(user == doc.exp_approver){
var reject_voucher_dialog;
set_reject_voucher_dialog = function() {
reject_voucher_dialog = new Dialog(400, 200, 'Reject Voucher');
reject_voucher_dialog.make_body([
['HTML', 'Message', '<div class = "comment">You wont be able to do any changes after rejecting this expense voucher. Are you sure, you want to reject it ?</div>'],
['HTML', 'Response', '<div class = "comment" id="reject_voucher_dialog_response"></div>'],
['HTML', 'Reject Voucher', '<div></div>']
]);
var reject_voucher_btn1 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
reject_voucher_btn1.innerHTML = 'Yes';
reject_voucher_btn1.onclick = function(){ reject_voucher_dialog.add(); }
var reject_voucher_btn2 = $a($i(reject_voucher_dialog.widgets['Reject Voucher']), 'button', 'button');
reject_voucher_btn2.innerHTML = 'No';
$y(reject_voucher_btn2,{marginLeft:'4px'});
reject_voucher_btn2.onclick = function(){ reject_voucher_dialog.hide();}
reject_voucher_dialog.onshow = function() {
$i('reject_voucher_dialog_response').innerHTML = '';
}
reject_voucher_dialog.add = function() {
// sending...
$i('reject_voucher_dialog_response').innerHTML = 'Processing...';
$c_obj(make_doclist(this.doc.doctype, this.doc.name),'reject_voucher','', function(r,rt){
if(r.message == 'Rejected'){
$i('reject_voucher_dialog_response').innerHTML = 'Rejected';
refresh_field('approval_status');
hide_field(['Update Voucher', 'Approve', 'Reject', 'Calculate Total Amount']);
reject_voucher_dialog.hide();
}
});
}
}
if(!reject_voucher_dialog){
set_reject_voucher_dialog();
}
reject_voucher_dialog.doc = doc;
reject_voucher_dialog.cdt = cdt;
reject_voucher_dialog.cdn = cdn;
reject_voucher_dialog.show();
refresh_field('expense_voucher_details');
doc.__unsaved = 0;
cur_frm.refresh_header();
}else{
msgprint("Expense Voucher can be rejected by Approver only");
}
}
//update follow up
//=================================================================================
cur_frm.cscript['Update Voucher'] = function(doc){
$c_obj(make_doclist(doc.doctype, doc.name),'update_voucher','',function(r, rt){
refresh_field('expense_voucher_details');
doc.__unsaved = 0;
cur_frm.refresh_header();
});
}

View File

@@ -0,0 +1,143 @@
# 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:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def get_employee_name(self):
emp_dtl = sql("select employee_name,company_email from `tabEmployee` where name=%s", self.doc.employee)
emp_nm = emp_dtl and emp_dtl[0][0] or ''
self.doc.employee_name = emp_nm
self.doc.email_id = emp_dtl and emp_dtl[0][1] or ''
return cstr(emp_nm)
def get_approver_lst(self):
approver_lst =[]
approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self)
if approver_lst1:
approver_lst=approver_lst1
else:
approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")]
return approver_lst
def set_approver(self):
ret={}
approver_lst =[]
emp_nm = self.get_employee_name()
approver_lst = self.get_approver_lst()
ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)}
return ret
def update_voucher(self):
sql("delete from `tabExpense Voucher Detail` where parent = '%s'"%self.doc.name)
for d in getlist(self.doclist, 'expense_voucher_details'):
if not d.expense_type or not d.claim_amount:
msgprint("Please remove the extra blank row added")
raise Exception
d.save(1)
if self.doc.total_sanctioned_amount:
set(self.doc,'total_sanctioned_amount',self.doc.total_sanctioned_amount)
if self.doc.remark:
set(self.doc, 'remark', self.doc.remark)
def approve_voucher(self):
for d in getlist(self.doclist, 'expense_voucher_details'):
if not d.sanctioned_amount:
msgprint("Please add 'Sanctioned Amount' for all expenses")
return cstr('Incomplete')
if not self.doc.total_sanctioned_amount:
msgprint("Please calculate total sanctioned amount using button 'Calculate Total Amount'")
return cstr('No Amount')
self.update_voucher()
set(self.doc, 'approval_status', 'Approved')
# on approval notification
get_obj('Notification Control').notify_contact('Expense Voucher Approved', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
return cstr('Approved')
def reject_voucher(self):
if self.doc.remark:
set(self.doc, 'remark', self.doc.remark)
set(self.doc, 'approval_status', 'Rejected')
# on approval notification
get_obj('Notification Control').notify_contact('Expense Voucher Rejected', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
return cstr('Rejected')
def validate_curr_exp(self):
for d in getlist(self.doclist, 'expense_voucher_details'):
if flt(d.sanctioned_amount) > 0:
if self.doc.approval_status == 'Draft':
msgprint("Sanctioned amount can be added by Approver person only for submitted Expense Voucher")
raise Exception
elif self.doc.approval_status == 'Submitted' and session['user'] != self.doc.exp_approver:
msgprint("Sanctioned amount can be added only by expense voucher Approver")
raise Exception
def validate_fiscal_year(self):
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
ysd=fy and fy[0][0] or ""
yed=add_days(str(ysd),365)
if str(self.doc.posting_date) < str(ysd) or str(self.doc.posting_date) > str(yed):
msgprint("Posting Date is not within the Fiscal Year selected")
raise Exception
def validate(self):
self.validate_curr_exp()
self.validate_fiscal_year()
def on_update(self):
set(self.doc, 'approval_status', 'Draft')
def validate_exp_details(self):
if not getlist(self.doclist, 'expense_voucher_details'):
msgprint("Please add expense voucher details")
raise Exception
if not self.doc.total_claimed_amount:
msgprint("Please calculate Total Claimed Amount")
raise Exception
if not self.doc.exp_approver:
msgprint("Please select Expense Voucher approver")
raise Exception
def validate_approver(self):
app_lst = self.get_approver_lst()
if self.doc.exp_approver and self.doc.exp_approver not in app_lst:
msgprint("Approver "+self.doc.exp_approver+" is not authorized to approve this expense voucher. Please select another approver")
valid_app = 'No'
else:
valid_app = 'Yes'
ret = {'app_lst':("\n" + "\n".join(app_lst)), 'valid_approver':valid_app}
return ret
def on_submit(self):
self.validate_exp_details()
set(self.doc, 'approval_status', 'Submitted')
def on_cancel(self):
set(self.doc, 'approval_status', 'Cancelled')

View File

@@ -0,0 +1,906 @@
[
{
'_last_update': None,
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': None,
'autoname': 'EXP.######',
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2010-09-03 16:45:05',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': None,
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2010-10-14 11:41:31',
'modified_by': 'Administrator',
'module': 'Payroll',
'name': 'Expense Voucher',
'name_case': '',
'owner': 'harshada@webnotestech.com',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': '',
'read_only': None,
'read_only_onload': None,
'search_fields': 'approval_status,employee,employee_name',
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': None,
'smallicon': None,
'subject': 'From %(employee_name)s for %(total_claimed_amount)s (claimed)',
'tag_fields': 'approval_status',
'use_template': None,
'version': 133
},
{
'amend': 1,
'cancel': 1,
'create': 1,
'creation': '2011-03-05 17:16:47',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': None,
'match': 'owner',
'modified': '2011-03-05 17:16:47',
'modified_by': 'Administrator',
'name': 'PERM00815',
'owner': 'Administrator',
'parent': 'Expense Voucher',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': None,
'read': 1,
'role': 'Employee',
'submit': 1,
'write': 1
},
{
'amend': 1,
'cancel': 1,
'create': 1,
'creation': '2011-03-05 17:16:47',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': None,
'match': None,
'modified': '2011-03-05 17:16:47',
'modified_by': 'Administrator',
'name': 'PERM00816',
'owner': 'Administrator',
'parent': 'Expense Voucher',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': None,
'read': 1,
'role': 'HR Manager',
'submit': 1,
'write': 1
},
{
'amend': 1,
'cancel': 1,
'create': 1,
'creation': '2011-03-05 17:16:47',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': None,
'match': None,
'modified': '2011-03-05 17:16:47',
'modified_by': 'Administrator',
'name': 'PERM00817',
'owner': 'Administrator',
'parent': 'Expense Voucher',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': None,
'read': 1,
'role': 'HR User',
'submit': 1,
'write': 1
},
{
'amend': None,
'cancel': None,
'create': None,
'creation': '2010-09-03 16:45:05',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 3,
'match': '',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'PERM00677',
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'All',
'submit': None,
'write': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Details',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03870',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Section Break',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-09-03 16:45:05',
'default': 'Draft',
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'approval_status',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': 1,
'label': 'Approval Status',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03871',
'no_column': None,
'no_copy': 1,
'oldfieldname': 'approval_status',
'oldfieldtype': 'Select',
'options': '\nDraft\nSubmitted\nApproved \nRejected\nCancelled',
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': 1,
'trigger': '',
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'employee',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': 1,
'label': 'From Employee',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03872',
'no_column': None,
'no_copy': None,
'oldfieldname': 'employee',
'oldfieldtype': 'Link',
'options': 'Employee',
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': 1,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'employee_name',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': 1,
'label': 'Employee Name',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03873',
'no_column': None,
'no_copy': None,
'oldfieldname': 'employee_name',
'oldfieldtype': 'Data',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': 1,
'trigger': None,
'width': '150px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 5,
'in_filter': 1,
'label': 'Fiscal Year',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03874',
'no_column': None,
'no_copy': None,
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Select',
'options': 'link:Fiscal Year',
'owner': 'ashwini@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 6,
'in_filter': 1,
'label': 'Company',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03875',
'no_column': None,
'no_copy': None,
'oldfieldname': 'company',
'oldfieldtype': 'Link',
'options': 'Company',
'owner': 'ashwini@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Column Break',
'hidden': None,
'icon': None,
'idx': 7,
'in_filter': None,
'label': '',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03876',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Column Break',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '50%'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'posting_date',
'fieldtype': 'Date',
'hidden': None,
'icon': None,
'idx': 8,
'in_filter': 1,
'label': 'Posting Date',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03877',
'no_column': None,
'no_copy': None,
'oldfieldname': 'posting_date',
'oldfieldtype': 'Date',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'exp_approver',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 9,
'in_filter': None,
'label': 'Approver',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03878',
'no_column': None,
'no_copy': None,
'oldfieldname': 'exp_approver',
'oldfieldtype': 'Select',
'options': '',
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '160px'
},
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'remark',
'fieldtype': 'Small Text',
'hidden': None,
'icon': None,
'idx': 10,
'in_filter': None,
'label': 'Remark',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03879',
'no_column': None,
'no_copy': 1,
'oldfieldname': 'remark',
'oldfieldtype': 'Small Text',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': '',
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 11,
'in_filter': None,
'label': 'Amended From',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03880',
'no_column': None,
'no_copy': 1,
'oldfieldname': 'amended_from',
'oldfieldtype': 'Data',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1,
'reqd': None,
'search_index': None,
'trigger': '',
'width': '160px'
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'hidden': None,
'icon': None,
'idx': 12,
'in_filter': None,
'label': 'Amendment Date',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03881',
'no_column': None,
'no_copy': 1,
'oldfieldname': 'amendment_date',
'oldfieldtype': 'Date',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1,
'reqd': None,
'search_index': None,
'trigger': '',
'width': '160px'
},
{
'allow_on_submit': 1,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': 1,
'icon': None,
'idx': 13,
'in_filter': None,
'label': 'Approve',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03882',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Button',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': 1,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': 1,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': 1,
'icon': None,
'idx': 14,
'in_filter': None,
'label': 'Reject',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03883',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Button',
'options': None,
'owner': 'ashwini@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': 1,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 15,
'in_filter': None,
'label': 'Expense Details',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03884',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Section Break',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': 1,
'colour': 'White:FFF',
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': None,
'icon': None,
'idx': 16,
'in_filter': None,
'label': 'Calculate Total Amount',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03885',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Button',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'total_claimed_amount',
'fieldtype': 'Currency',
'hidden': None,
'icon': None,
'idx': 17,
'in_filter': 0,
'label': 'Total Claimed Amount',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03886',
'no_column': None,
'no_copy': 1,
'oldfieldname': 'total_claimed_amount',
'oldfieldtype': 'Currency',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': 0,
'search_index': None,
'trigger': '',
'width': '160px'
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'total_sanctioned_amount',
'fieldtype': 'Currency',
'hidden': None,
'icon': None,
'idx': 18,
'in_filter': 0,
'label': 'Total Sanctioned Amount',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03887',
'no_column': None,
'no_copy': 1,
'oldfieldname': 'total_sanctioned_amount',
'oldfieldtype': 'Currency',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': '',
'width': '160px'
},
{
'allow_on_submit': 1,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': 1,
'icon': None,
'idx': 19,
'in_filter': None,
'label': 'Update Voucher',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03888',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Button',
'options': '',
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': 1,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': 1,
'colour': None,
'creation': '2010-09-03 16:45:05',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'expense_voucher_details',
'fieldtype': 'Table',
'hidden': None,
'icon': None,
'idx': 20,
'in_filter': None,
'label': 'Expense Voucher Details',
'modified': '2010-09-03 16:45:05',
'modified_by': 'Administrator',
'name': 'FL03889',
'no_column': None,
'no_copy': None,
'oldfieldname': 'expense_voucher_details',
'oldfieldtype': 'Table',
'options': 'Expense Voucher Detail',
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': '',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-10-15 14:56:33',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'email_id',
'fieldtype': 'Data',
'hidden': 1,
'icon': None,
'idx': 21,
'in_filter': None,
'label': 'Employees Email Id',
'modified': '2010-10-15 14:56:33',
'modified_by': 'Administrator',
'name': 'FL03982',
'no_column': None,
'no_copy': None,
'oldfieldname': 'email_id',
'oldfieldtype': 'Data',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Expense Voucher',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': 1,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
}
]

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-23 18:10:16', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': None, 'name': 'Expense Voucher Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Date', 'creation': '2010-08-23 18:10:16', 'doctype': 'DocField', 'oldfieldname': 'expense_date', 'owner': 'harshada@webnotestech.com', 'reqd': 0, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Expense Date', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05982', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-03 16:32:58', 'parenttype': 'DocType', 'fieldname': 'expense_date', 'fieldtype': 'Date', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2010-08-23 18:10:16', 'doctype': 'DocField', 'oldfieldname': 'expense_type', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Expense Type', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05983', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-03 16:32:58', 'parenttype': 'DocType', 'fieldname': 'expense_type', 'fieldtype': 'Link', 'options': 'Expense Type', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-23 18:10:16', 'doctype': 'DocField', 'oldfieldname': 'description', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Description', 'width': '150px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05984', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-09-03 16:32:58', 'parenttype': 'DocType', 'fieldname': 'description', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-08-23 18:10:16', 'doctype': 'DocField', 'oldfieldname': 'claim_amount', 'owner': 'harshada@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Claim Amount', 'width': '150px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Voucher Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05985', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-09-03 16:32:58', 'parenttype': 'DocType', 'fieldname': 'claim_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': 1, 'oldfieldtype': 'Currency', 'creation': '2010-08-23 18:10:16', 'doctype': 'DocField', 'oldfieldname': 'sanctioned_amount', 'owner': 'harshada@webnotestech.com', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Sanctioned Amount', 'width': '150px', 'trigger': 'Client', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Expense Voucher Detail', 'search_index': None, 'allow_on_submit': 1, 'icon': None, 'name': 'FL05986', 'idx': 5, 'default': None, 'colour': None, 'modified': '2010-09-03 16:32:58', 'parenttype': 'DocType', 'fieldname': 'sanctioned_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

File diff suppressed because one or more lines are too long

View File

View File

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-01 14:14:44', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 8, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:grade_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Grade', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00731', 'parent': 'Grade', 'read': 1, 'create': 1, 'creation': '2010-04-01 14:14:44', 'modified': '2010-09-20 09:41:00', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00799', 'parent': 'Grade', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:54:49', 'modified': '2010-09-20 09:41:00', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00800', 'parent': 'Grade', 'read': 1, 'create': 1, 'creation': '2010-04-19 09:54:49', 'modified': '2010-09-20 09:41:00', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Grade', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04846', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:41:00', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-01 14:14:44', 'doctype': 'DocField', 'oldfieldname': 'grade_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Grade', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Grade', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04378', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:41:00', 'parenttype': 'DocType', 'fieldname': 'grade_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1,116 @@
# 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
import datetime
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
# ---------
# autoname
# ---------
def autoname(self):
self.doc.name = make_autoname(self.doc.fiscal_year +"/"+ self.doc.holiday_list_name+"/.###")
# *************************************************** utilities ***********************************************
# ----------------
# validate values
# ----------------
def validate_values(self):
if not self.doc.fiscal_year:
msgprint("Please select Fiscal Year")
raise Exception
if not self.doc.weekly_off:
msgprint("Please select weekly off day")
raise Exception
# ------------------------------------
# get fiscal year start and end dates
# ------------------------------------
def get_fy_start_end_dates(self):
st_date = sql("select year_start_date from `tabFiscal Year` where name = '%s'" %(self.doc.fiscal_year))
st_date = st_date and st_date[0][0].strftime('%Y-%m-%d') or ''
ed_date = add_days(add_years(st_date,1), -1)
return st_date, ed_date
# -------------------------
# get weekly off date list
# -------------------------
def get_weekly_off_date_list(self, yr_start_date, yr_end_date):
days_dict, dt_list, lst_st = {'Monday':0,'Tuesday':1,'Wednesday':2,'Thursday':3,'Friday':4,'Saturday':5,'Sunday':6}, [], ''
w = cint(days_dict[self.doc.weekly_off]) # Weekly Off Day No.
st_dt_weekday = getdate(yr_start_date).weekday() # Year Start Date weekday()
if w == st_dt_weekday: # Get Start Date
lst_st = yr_start_date
dt_list.append(lst_st)
elif w > st_dt_weekday:
lst_st = add_days(yr_start_date,w - st_dt_weekday)
dt_list.append(lst_st)
else:
lst_st = add_days(yr_start_date,6 - st_dt_weekday + 1)
dt_list.append(lst_st)
while getdate(lst_st) < getdate(yr_end_date): # Get list of dates
lst_st = add_days(lst_st,7)
if getdate(lst_st) > getdate(yr_end_date):
break
dt_list.append(lst_st)
return dt_list
# ---------------------
# get weekly off dates
# ---------------------
def get_weekly_off_dates(self):
self.validate_values()
yr_start_date, yr_end_date = self.get_fy_start_end_dates()
date_list = self.get_weekly_off_date_list(yr_start_date, yr_end_date)
for d in date_list:
ch = addchild(self.doc, 'holiday_list_details', 'Holiday List Detail', 1, self.doclist)
ch.description = self.doc.weekly_off
ch.holiday_date = d
# ------------
# clear table
# ------------
def clear_table(self):
self.doc.clear_table(self.doclist,'holiday_list_details')
# ***************************************** validate *************************************************
# ---------------------------
# check default holiday list
# ---------------------------
def update_default_holiday_list(self):
sql("update `tabHoliday List` set is_default = 0 where ifnull(is_default, 0) = 1 and fiscal_year = '%s'" % (self.doc.fiscal_year))
# ---------
# validate
# ---------
def validate(self):
self.update_default_holiday_list()

View File

@@ -0,0 +1,381 @@
[
{
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': 1,
'autoname': None,
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:09:03',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': 'Master',
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'module': 'Payroll',
'name': 'Holiday List',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': None,
'read_only_onload': None,
'search_fields': None,
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': 0,
'smallicon': None,
'use_template': None,
'version': 17
},
{
'amend': None,
'cancel': 1,
'create': 1,
'creation': '2010-08-08 17:09:03',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 1,
'match': None,
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'name': 'PERM00249',
'owner': 'harshada@webnotestech.com',
'parent': 'Holiday List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'HR Manager',
'submit': None,
'write': 1
},
{
'amend': None,
'cancel': None,
'create': None,
'creation': '2011-02-11 14:00:28',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 2,
'match': None,
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'name': 'PERM00806',
'owner': 'Administrator',
'parent': 'Holiday List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'HR Manager',
'submit': None,
'write': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:03',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Trash Reason',
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'name': 'FL01452',
'no_copy': None,
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'options': None,
'owner': 'Administrator',
'parent': 'Holiday List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:03',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'holiday_list_name',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': None,
'label': 'Holiday List Name',
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'name': 'FL01453',
'no_copy': None,
'oldfieldname': 'holiday_list_name',
'oldfieldtype': 'Data',
'options': None,
'owner': 'Administrator',
'parent': 'Holiday List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-12 13:37:12',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'is_default',
'fieldtype': 'Check',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': None,
'label': 'Default',
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'name': 'FL04508',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Holiday List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:03',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': 1,
'label': 'Fiscal Year',
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'name': 'FL01454',
'no_copy': None,
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Link',
'options': 'link:Fiscal Year',
'owner': 'Administrator',
'parent': 'Holiday List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-11 14:00:13',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'weekly_off',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 5,
'in_filter': None,
'label': 'Weekly Off',
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'name': 'FL04505',
'no_copy': 1,
'oldfieldname': None,
'oldfieldtype': None,
'options': '\nSunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday',
'owner': 'Administrator',
'parent': 'Holiday List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-11 14:00:13',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': None,
'icon': None,
'idx': 6,
'in_filter': None,
'label': 'Get Weekly Off Dates',
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'name': 'FL04506',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': 'get_weekly_off_dates',
'owner': 'Administrator',
'parent': 'Holiday List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:03',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'holiday_list_details',
'fieldtype': 'Table',
'hidden': None,
'icon': None,
'idx': 7,
'in_filter': None,
'label': 'Holiday List Details',
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'name': 'FL01455',
'no_copy': None,
'oldfieldname': 'holiday_list_details',
'oldfieldtype': 'Table',
'options': 'Holiday List Detail',
'owner': 'Administrator',
'parent': 'Holiday List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 0,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-11 17:19:50',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': None,
'icon': None,
'idx': 8,
'in_filter': None,
'label': 'Clear Table',
'modified': '2011-02-12 13:37:12',
'modified_by': 'Administrator',
'name': 'FL04507',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': 'clear_table',
'owner': 'Administrator',
'parent': 'Holiday List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
}
]

View File

@@ -0,0 +1,125 @@
[
{
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': None,
'autoname': None,
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:09:03',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': None,
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': 1,
'max_attachments': None,
'menu_index': None,
'modified': '2011-02-11 14:23:09',
'modified_by': 'Administrator',
'module': 'Payroll',
'name': 'Holiday List Detail',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': None,
'read_only_onload': None,
'search_fields': None,
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': 0,
'smallicon': None,
'use_template': None,
'version': 4
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:03',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Small Text',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Description',
'modified': '2011-02-11 14:23:09',
'modified_by': 'Administrator',
'name': 'FL01456',
'no_copy': None,
'oldfieldname': 'holiday_name',
'oldfieldtype': 'Data',
'options': None,
'owner': 'Administrator',
'parent': 'Holiday List Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '150px'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:03',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'holiday_date',
'fieldtype': 'Date',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': None,
'label': 'Date',
'modified': '2011-02-11 14:23:09',
'modified_by': 'Administrator',
'name': 'FL01457',
'no_copy': None,
'oldfieldname': 'holiday_date',
'oldfieldtype': 'Date',
'options': None,
'owner': 'Administrator',
'parent': 'Holiday List Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '100px'
}
]

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,161 @@
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

@@ -0,0 +1,419 @@
# 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 `tabSS Earning Detail` 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 `tabSS Deduction Detail` 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 `tabEarning Detail` 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 `tabDeduction Detail` 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 `tabSS Earning Detail` 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 `tabSS Deduction Detail` 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)
# on update
def on_update(self):
obj = get_obj('Feed Control', 'Feed Control')
obj.make_feed(self.doc)

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-08-25 16:43:38', 'search_fields': None, 'module': 'Payroll', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'ashwini@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 6, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'KSHEET.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': None, 'name': 'KRA Sheet', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-08-25 16:43:38', 'doctype': 'DocField', 'oldfieldname': 'kra', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'KRA', 'width': '200px', 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': 'Key Performance Area', 'parent': 'KRA Sheet', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06027', 'idx': 1, 'default': None, 'colour': 'White:FFF', 'modified': '2010-09-01 14:13:04', 'parenttype': 'DocType', 'fieldname': 'kra', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-08-25 16:43:38', 'doctype': 'DocField', 'oldfieldname': 'per_weightage', 'owner': 'ashwini@webnotestech.com', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Weightage (%)', 'width': '100px', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'KRA Sheet', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL06029', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-01 14:13:04', 'parenttype': 'DocType', 'fieldname': 'per_weightage', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,11 @@
cur_frm.cscript.onload=function(doc,dt,dn){if(!doc.posting_date)set_multiple(dt,dn,{posting_date:get_today()});}
cur_frm.add_fetch('employee','employee_name','employee_name');cur_frm.cscript.employee=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
cur_frm.cscript.leave_type=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
cur_frm.cscript.fiscal_year=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
cur_frm.cscript.carry_forward=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
cur_frm.cscript.carry_forwarded_leaves=function(doc,dt,dn){set_multiple(dt,dn,{total_leaves_allocated:flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});}
cur_frm.cscript.new_leaves_allocated=function(doc,dt,dn){set_multiple(dt,dn,{total_leaves_allocated:flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});}
calculate_total_leaves_allocated=function(doc,dt,dn){if(cint(doc.carry_forward)==1&&doc.leave_type&&doc.fiscal_year&&doc.employee){var callback=function(){refresh_field('carry_forward');}
get_server_fields('get_carry_forwarded_leaves','','',doc,dt,dn,1,callback);}
else if(cint(doc.carry_forward)==0){set_multiple(dt,dn,{carry_forwarded_leaves:0,total_leaves_allocated:flt(doc.new_leaves_allocated)});}}

View File

@@ -0,0 +1,64 @@
// ****************************************** onload ********************************************************
cur_frm.cscript.onload = function(doc, dt, dn) {
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
}
// ************************************** client triggers ***************************************************
// ---------
// employee
// ---------
cur_frm.add_fetch('employee','employee_name','employee_name');
cur_frm.cscript.employee = function(doc, dt, dn) {
calculate_total_leaves_allocated(doc, dt, dn);
}
// -----------
// leave type
// -----------
cur_frm.cscript.leave_type = function(doc, dt, dn) {
calculate_total_leaves_allocated(doc, dt, dn);
}
// ------------
// fiscal year
// ------------
cur_frm.cscript.fiscal_year = function(doc, dt, dn) {
calculate_total_leaves_allocated(doc, dt, dn);
}
// -------------------------------
// include previous leave balance
// -------------------------------
cur_frm.cscript.carry_forward = function(doc, dt, dn) {
calculate_total_leaves_allocated(doc, dt, dn);
}
// -----------------------
// previous balance leaves
// -----------------------
cur_frm.cscript.carry_forwarded_leaves = function(doc, dt, dn) {
set_multiple(dt,dn,{total_leaves_allocated : flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});
}
// ---------------------
// new leaves allocated
// ---------------------
cur_frm.cscript.new_leaves_allocated = function(doc, dt, dn) {
set_multiple(dt,dn,{total_leaves_allocated : flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});
}
// ****************************************** utilities ******************************************************
// ---------------------------------
// calculate total leaves allocated
// ---------------------------------
calculate_total_leaves_allocated = function(doc, dt, dn) {
if(cint(doc.carry_forward) == 1 && doc.leave_type && doc.fiscal_year && doc.employee){
get_server_fields('get_carry_forwarded_leaves','','', doc, dt, dn, 1);
}
else if(cint(doc.carry_forward) == 0){
set_multiple(dt,dn,{carry_forwarded_leaves : 0,total_leaves_allocated : flt(doc.new_leaves_allocated)});
}
}

View File

@@ -0,0 +1,121 @@
# 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
import datetime
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, doc, doclist):
self.doc = doc
self.doclist = doclist
# ************************************************ utilities *************************************************
# --------------
# get leave bal
# --------------
def get_leave_bal(self, prev_fyear):
# leaves allocates
tot_leaves_all = sql("select SUM(total_leaves_allocated) from `tabLeave Allocation` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1 and name != '%s'" % (self.doc.employee, self.doc.leave_type, prev_fyear, self.doc.name))
tot_leaves_all = tot_leaves_all and flt(tot_leaves_all[0][0]) or 0
# leaves applied
tot_leaves_app = sql("select SUM(total_leave_days) from `tabLeave Application` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1" % (self.doc.employee, self.doc.leave_type, prev_fyear))
tot_leaves_app = tot_leaves_app and flt(tot_leaves_app[0][0]) or 0
return tot_leaves_all - tot_leaves_app
# ******************************************** client triggers ***********************************************
# ------------------------------------------------------------------
# check whether carry forward is allowed or not for this leave type
# ------------------------------------------------------------------
def allow_carry_forward(self):
cf = sql("select is_carry_forward from `tabLeave Type` where name = %s" , self.doc.leave_type)
cf = cf and cint(cf[0][0]) or 0
if not cf:
set(self.doc,'carry_forward',0)
msgprint("Sorry ! You cannot carry forward %s" % (self.doc.leave_type))
raise Exception
# ---------------------------
# get carry forwarded leaves
# ---------------------------
def get_carry_forwarded_leaves(self):
if self.doc.carry_forward: self.allow_carry_forward()
prev_fiscal_year = sql("select name from `tabFiscal Year` where name < '%s' order by name desc limit 1" % (self.doc.fiscal_year))
prev_fiscal_year = prev_fiscal_year and prev_fiscal_year[0][0] or ''
ret = {}
prev_bal = 0
if prev_fiscal_year and cint(self.doc.carry_forward) == 1:
prev_bal = self.get_leave_bal(prev_fiscal_year)
ret = {
'carry_forwarded_leaves' : prev_bal,
'total_leaves_allocated' : flt(prev_bal) + flt(self.doc.new_leaves_allocated)
}
return str(ret)
# ********************************************** validate *****************************************************
# ---------------------------
# get total allocated leaves
# ---------------------------
def get_total_allocated_leaves(self):
leave_det = eval(self.get_carry_forwarded_leaves())
set(self.doc,'carry_forwarded_leaves',flt(leave_det['carry_forwarded_leaves']))
set(self.doc,'total_leaves_allocated',flt(leave_det['total_leaves_allocated']))
# ------------------------------------------------------------------------------------
# validate leave (i.e. check whether leave for same type is already allocated or not)
# ------------------------------------------------------------------------------------
def validate_allocated_leave(self):
l = sql("select name from `tabLeave Allocation` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1" % (self.doc.employee, self.doc.leave_type, self.doc.fiscal_year))
l = l and l[0][0] or ''
if l:
msgprint("%s is allocated to Employee: %s for Fiscal Year : %s. Please refer Leave Allocation : %s" % (self.doc.leave_type, self.doc.employee, self.doc.fiscal_year, l))
raise Exception
# ---------
# validate
# ---------
def validate(self):
self.validate_allocated_leave()
# ----------
# on update
# ----------
def on_update(self):
self.get_total_allocated_leaves()
# ********************************************** cancel ********************************************************
# -------------------------
# check for applied leaves
# -------------------------
def check_for_leave_application(self):
chk = sql("select name from `tabLeave Application` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1" % (self.doc.employee, self.doc.leave_type, self.doc.fiscal_year))
chk = chk and chk[0][0] or ''
if chk:
msgprint("Cannot cancel this Leave Allocation as Employee : %s has already applied for %s. Please check Leave Application : %s" % (self.doc.employee, self.doc.leave_type, chk))
raise Exception
# -------
# cancel
# -------
def on_cancel(self):
self.check_for_leave_application()

View File

@@ -0,0 +1,637 @@
[
{
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': None,
'autoname': 'LAL/.#####',
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2011-02-21 10:01:22',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': None,
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'module': 'Payroll',
'name': 'Leave Allocation',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': None,
'read_only_onload': None,
'search_fields': 'employee,employee_name,leave_type,total_leaves_allocated,fiscal_year',
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': 0,
'smallicon': None,
'use_template': None,
'version': 1565
},
{
'amend': 1,
'cancel': 1,
'create': 1,
'creation': '2011-02-21 10:01:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 1,
'match': 'owner',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'PERM00731',
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': None,
'read': 1,
'role': 'HR User',
'submit': 1,
'write': 1
},
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2011-02-21 10:01:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 2,
'match': 'owner',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'PERM00732',
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': None,
'read': 1,
'role': 'HR User',
'submit': 0,
'write': 0
},
{
'amend': 1,
'cancel': 1,
'create': 1,
'creation': '2011-02-21 10:01:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 3,
'match': None,
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'PERM00733',
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'HR Manager',
'submit': 1,
'write': 1
},
{
'amend': None,
'cancel': None,
'create': None,
'creation': '2011-02-21 10:01:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 4,
'match': None,
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'PERM00734',
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'HR Manager',
'submit': None,
'write': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-15 11:25:20',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'column_break1',
'fieldtype': 'Column Break',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': None,
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04659',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '50%'
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-02-21 10:01:22',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'employee',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': 1,
'label': 'Employee',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04152',
'no_copy': None,
'oldfieldname': 'employee',
'oldfieldtype': 'Link',
'options': 'Employee',
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': 1,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-17 13:33:15',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'employee_name',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': 1,
'label': 'Employee Name',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04767',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': 1,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-02-21 10:01:22',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'leave_type',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': 1,
'label': 'Leave Type',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04153',
'no_copy': None,
'oldfieldname': 'leave_type',
'oldfieldtype': 'Link',
'options': '\nCasual Leave\nCompensatory Off\nLeave Without Pay\nPaternity Leave\nPrivilege Leave\nSick Leave',
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': 1,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-02-21 10:01:22',
'default': 'Today',
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'posting_date',
'fieldtype': 'Date',
'hidden': 0,
'icon': None,
'idx': 5,
'in_filter': None,
'label': 'Posting Date',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04154',
'no_copy': 1,
'oldfieldname': 'date',
'oldfieldtype': 'Date',
'options': None,
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': 0,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-02-21 10:01:22',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 6,
'in_filter': 1,
'label': 'Fiscal Year',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04155',
'no_copy': None,
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Data',
'options': '\n2010-2011\n2011-2012\n2012-2013',
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': 1,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-02-21 10:01:23',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Small Text',
'hidden': 0,
'icon': None,
'idx': 7,
'in_filter': None,
'label': 'Description',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04156',
'no_copy': None,
'oldfieldname': 'reason',
'oldfieldtype': 'Small Text',
'options': None,
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-15 11:25:20',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'column_break7',
'fieldtype': 'Column Break',
'hidden': None,
'icon': None,
'idx': 8,
'in_filter': None,
'label': None,
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04660',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '50%'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-21 10:01:23',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'carry_forward',
'fieldtype': 'Check',
'hidden': None,
'icon': None,
'idx': 9,
'in_filter': None,
'label': 'Carry Forward',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04158',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-21 10:01:23',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'carry_forwarded_leaves',
'fieldtype': 'Currency',
'hidden': None,
'icon': None,
'idx': 10,
'in_filter': None,
'label': 'Carry Forwarded Leaves',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04159',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-21 10:01:23',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'new_leaves_allocated',
'fieldtype': 'Currency',
'hidden': None,
'icon': None,
'idx': 11,
'in_filter': None,
'label': 'New Leaves Allocated',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04160',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-21 10:01:23',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'total_leaves_allocated',
'fieldtype': 'Currency',
'hidden': None,
'icon': None,
'idx': 12,
'in_filter': None,
'label': 'Total Leaves Allocated',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04161',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-21 10:01:23',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Data',
'hidden': 0,
'icon': None,
'idx': 13,
'in_filter': None,
'label': 'Amended From',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04162',
'no_copy': None,
'oldfieldname': 'amended_from',
'oldfieldtype': 'Data',
'options': None,
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': 1,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-02-21 10:01:23',
'default': None,
'depends_on': None,
'description': 'The date at which current entry is corrected in the system.',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'hidden': 0,
'icon': None,
'idx': 14,
'in_filter': None,
'label': 'Amendment Date',
'modified': '2011-02-17 13:47:13',
'modified_by': 'Administrator',
'name': 'FL04163',
'no_copy': None,
'oldfieldname': 'amendment_date',
'oldfieldtype': 'Date',
'options': None,
'owner': 'Administrator',
'parent': 'Leave Allocation',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': 1,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
}
]

Some files were not shown because too many files have changed in this diff Show More