Merge branch 'master' of github.com:webnotes/erpnext

Conflicts:
	accounts/search_criteria/lease_agreement_list/lease_agreement_list.txt
	accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.txt
	accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.txt
diff --git a/accounts/doctype/account/account.py b/accounts/doctype/account/account.py
index f5e4a6d..52c66a9 100644
--- a/accounts/doctype/account/account.py
+++ b/accounts/doctype/account/account.py
@@ -94,8 +94,8 @@
 	def convert_group_to_ledger(self):
 		if self.check_if_child_exists():
 			msgprint("Account: %s has existing child. You can not convert this account to ledger" % (self.doc.name), raise_exception=1)
-		elif self.check_prev_bal_exists():
-			msgprint("Account with balance can not be converted to ledger.", raise_exception=1)
+		elif self.check_gle_exists():
+			msgprint("Account with existing transaction can not be converted to ledger.", raise_exception=1)
 		else:
 			self.doc.group_or_ledger = 'Ledger'
 			self.doc.save()
@@ -104,8 +104,8 @@
 	# Convert ledger to group
 	# ==================================================================
 	def convert_ledger_to_group(self):
-		if self.check_prev_bal_exists():
-			msgprint("Account with balance can not be converted to group.", raise_exception=1)
+		if self.check_gle_exists():
+			msgprint("Account with existing transaction can not be converted to group.", raise_exception=1)
 		else:
 			self.doc.group_or_ledger = 'Group'
 			self.doc.save()
@@ -113,9 +113,9 @@
 
 	# Check if any previous balance exists
 	# ==================================================================
-	def check_prev_bal_exists(self):
-		bal = sql("select balance from `tabAccount Balance` where parent = '%s' and ifnull(balance, 0) > 0" % (self.doc.name))
-		return bal and flt(bal[0][0]) or 0
+	def check_gle_exists(self):
+		exists = sql("select name from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No') = 'No'" % (self.doc.name))
+		return exists and exists[0][0] or ''
 
 	# check if child exists
 	# ==================================================================
@@ -231,8 +231,8 @@
 	# Account with balance cannot be inactive
 	# ==================================================================
 	def check_balance_before_trash(self):
-		if flt(self.get_curr_bal()) != 0:
-			msgprint("Account with existing balance can not be trashed", raise_exception=1)
+		if self.check_gle_exists():
+			msgprint("Account with existing transaction can not be trashed", raise_exception=1)
 		if self.check_if_child_exists():
 			msgprint("Child account exists for this account. You can not trash this account.", raise_exception=1)
 
diff --git a/accounts/search_criteria/lease_agreement_list/lease_agreement_list.txt b/accounts/search_criteria/lease_agreement_list/lease_agreement_list.txt
deleted file mode 100644
index c57f059..0000000
--- a/accounts/search_criteria/lease_agreement_list/lease_agreement_list.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Search Criteria, lease_agreement_list
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-26 17:01:34',
-		'docstatus': 0,
-		'modified': '2011-07-28 11:18:26',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
-		'criteria_name': 'Lease Agreement List',
-		'doc_type': 'GL Entry',
-		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, lease_agreement_list
-	{
-		'doctype': 'Search Criteria',
-		'name': 'lease_agreement_list'
-	}
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.txt b/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.txt
index 3a41f8f..a531bb9 100644
--- a/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.txt
+++ b/accounts/search_criteria/lease_monthly_future_installment_inflows/lease_monthly_future_installment_inflows.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-07-26 16:45:07',
+		'creation': '2011-07-27 13:14:29',
 		'docstatus': 0,
-		'modified': '2011-07-26 18:26:16',
+		'modified': '2011-07-27 13:14:29',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
diff --git a/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.txt b/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.txt
index d8e935b..dcd0f94 100644
--- a/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.txt
+++ b/accounts/search_criteria/lease_overdue_age_wise/lease_overdue_age_wise.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-07-26 18:11:10',
+		'creation': '2011-07-27 13:14:29',
 		'docstatus': 0,
-		'modified': '2011-07-26 18:26:40',
+		'modified': '2011-07-27 13:14:29',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
diff --git a/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.txt b/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.txt
deleted file mode 100644
index f63462f..0000000
--- a/accounts/search_criteria/lease_receipt_summary_month_wise/lease_receipt_summary_month_wise.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Search Criteria, lease_receipt_summary_month_wise
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-27 18:48:29',
-		'docstatus': 0,
-		'modified': '2011-07-28 09:59:51',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
-		'criteria_name': 'Lease Receipt Summary Month Wise',
-		'doc_type': 'GL Entry',
-		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, lease_receipt_summary_month_wise
-	{
-		'doctype': 'Search Criteria',
-		'name': 'lease_receipt_summary_month_wise'
-	}
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.txt b/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.txt
deleted file mode 100644
index 25c15c2..0000000
--- a/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Search Criteria, lease_receipts_client_wise
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2011-07-28 12:13:41',
-		'docstatus': 0,
-		'modified': '2011-07-28 12:16:13',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'columns': 'GL Entry\x01ID,GL Entry\x01Owner,GL Entry\x01Posting Date,GL Entry\x01Aging Date,GL Entry\x01Account,GL Entry\x01Cost Center,GL Entry\x01Against,GL Entry\x01Against Voucher,GL Entry\x01Voucher Type,GL Entry\x01Voucher No,GL Entry\x01Remarks,GL Entry\x01Is Cancelled,GL Entry\x01Is Opening,GL Entry\x01Fiscal Year,GL Entry\x01Company',
-		'criteria_name': 'Lease Receipts Client Wise',
-		'doc_type': 'GL Entry',
-		'doctype': 'Search Criteria',
-		'filters': "{'GL Entry\x01Voucher Type':'','GL Entry\x01Is Cancelled':'','GL Entry\x01Is Opening':'','GL Entry\x01Fiscal Year':''}",
-		'module': 'Accounts',
-		'name': '__common__',
-		'page_len': 50,
-		'standard': 'Yes'
-	},
-
-	# Search Criteria, lease_receipts_client_wise
-	{
-		'doctype': 'Search Criteria',
-		'name': 'lease_receipts_client_wise'
-	}
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.txt b/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.txt
index 6e14165..aa52224 100644
--- a/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.txt
+++ b/accounts/search_criteria/lease_yearly_future_installment_inflows/lease_yearly_future_installment_inflows.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-07-26 16:24:45',
+		'creation': '2011-07-27 13:14:29',
 		'docstatus': 0,
-		'modified': '2011-07-26 18:28:03',
+		'modified': '2011-07-27 13:14:29',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
diff --git a/analysis/doctype/mis_control/mis_control.py b/analysis/doctype/mis_control/mis_control.py
index 08a71f2..5af36e9 100644
--- a/analysis/doctype/mis_control/mis_control.py
+++ b/analysis/doctype/mis_control/mis_control.py
@@ -195,7 +195,7 @@
   # Get Children
   # ------------
   def get_children(self, parent_account, level, pl, company, fy):
-    cl = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where ifnull(parent_account, '') = %s and ifnull(is_pl_account, 'No')=%s and company=%s order by name asc", (parent_account, pl, company))
+    cl = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where ifnull(parent_account, '') = %s and ifnull(is_pl_account, 'No')=%s and company=%s and docstatus != 2 order by name asc", (parent_account, pl, company))
     level0_diff = [0 for p in self.period_list]
     if pl=='Yes' and level==0: # switch for income & expenses
       cl = [c for c in cl]
@@ -295,7 +295,7 @@
         sd = self.ysd.strftime('%Y-%m-%d')
         cond = ""
 
-      bal = sql("select SUM(t1.debit), SUM(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' AND t1.company = '%s' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(is_opening,'No') = 'No' %s" % (sd,ed,company,lft,rgt, cond))
+      bal = sql("select SUM(t1.debit), SUM(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' AND t1.company = '%s' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(t1.is_opening,'No') = 'No' and ifnull(t1.is_cancelled, 'No') = 'No' %s" % (sd,ed,company,lft,rgt, cond))
       
       
       bal = bal and (flt(bal[0][0]) - flt(bal[0][1])) or 0
@@ -316,7 +316,7 @@
     a = sql("select account_name, name, debit_or_credit, lft, rgt, is_pl_account from `tabAccount` where account_name=%s and company=%s", (acc, company), as_dict=1)
     if a:
       a = a[0]
-      bal = sql("select SUM(IFNULL(t1.debit,0)), SUM(IFNULL(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= %s AND t1.posting_date <= %s AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(is_opening, 'No') = 'No'", (sd,ed,a['lft'],a['rgt']))
+      bal = sql("select SUM(IFNULL(t1.debit,0)), SUM(IFNULL(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= %s AND t1.posting_date <= %s AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s and ifnull(is_opening, 'No') = 'No' and ifnull(t1.is_cancelled, 'No') = 'No'", (sd,ed,a['lft'],a['rgt']))
       if a['debit_or_credit']=='Debit':
         bal = flt(flt(bal[0][0]) - flt(bal[0][1]))
       else:
@@ -341,13 +341,13 @@
     rec_grp = sql("select receivables_group from tabCompany where name=%s", company)
     if rec_grp:
       pa_lft_rgt = sql("select lft, rgt from tabAccount where name=%s and company=%s", (rec_grp[0][0], company))[0]
-      return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft > %s and t1.rgt < %s and t2.account = t1.name GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (pa_lft_rgt[0], pa_lft_rgt[1]))
+      return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft > %s and t1.rgt < %s and t2.account = t1.name  and ifnull(t2.is_cancelled, 'No') = 'No' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (pa_lft_rgt[0], pa_lft_rgt[1]))
     else:
       return []
 
   def get_top_5_exp(self, company):
     a = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where account_name=%s and company=%s", ('Expenses', company), as_dict=1)[0]
-    return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft>%s and t1.rgt<%s and t1.group_or_ledger = 'Ledger' and t2.account = t1.name and t2.voucher_type != 'Period Closing Voucher' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (a['lft'],a['rgt']))
+    return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft>%s and t1.rgt<%s and t1.group_or_ledger = 'Ledger' and t2.account = t1.name  and ifnull(t2.is_cancelled, 'No') = 'No' and t2.voucher_type != 'Period Closing Voucher' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (a['lft'],a['rgt']))
   
   def bl(self, acc, company):
     dt = getdate(nowdate())
diff --git a/hr/doctype/salary_slip/salary_slip.txt b/hr/doctype/salary_slip/salary_slip.txt
new file mode 100644
index 0000000..423b6c0
--- /dev/null
+++ b/hr/doctype/salary_slip/salary_slip.txt
@@ -0,0 +1,602 @@
+# DocType, Salary Slip
+[
+
+	# These values are common in all dictionaries
+	{
+		'creation': '2010-08-08 17:09:20',
+		'docstatus': 0,
+		'modified': '2011-07-27 13:10:28',
+		'modified_by': 'Administrator',
+		'owner': 'Administrator'
+	},
+
+	# These values are common for all DocType
+	{
+		'_last_update': '1310019491',
+		'colour': 'White:FFF',
+		'doctype': 'DocType',
+		'module': 'HR',
+		'name': '__common__',
+		'section_style': 'Simple',
+		'server_code_error': ' ',
+		'show_in_menu': 0,
+		'subject': 'For %(employee_name)s, %(designation)s',
+		'version': 393
+	},
+
+	# These values are common for all DocField
+	{
+		'doctype': 'DocField',
+		'name': '__common__',
+		'parent': 'Salary Slip',
+		'parentfield': 'fields',
+		'parenttype': 'DocType'
+	},
+
+	# These values are common for all DocPerm
+	{
+		'doctype': 'DocPerm',
+		'name': '__common__',
+		'parent': 'Salary Slip',
+		'parentfield': 'permissions',
+		'parenttype': 'DocType',
+		'read': 1
+	},
+
+	# DocType, Salary Slip
+	{
+		'doctype': 'DocType',
+		'name': 'Salary Slip'
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'cancel': 0,
+		'create': 0,
+		'doctype': 'DocPerm',
+		'idx': 1,
+		'match': 'owner',
+		'permlevel': 0,
+		'role': 'Employee',
+		'submit': 0,
+		'write': 0
+	},
+
+	# DocPerm
+	{
+		'amend': 0,
+		'create': 1,
+		'doctype': 'DocPerm',
+		'idx': 2,
+		'permlevel': 0,
+		'role': 'HR User',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
+		'doctype': 'DocPerm',
+		'idx': 3,
+		'permlevel': 0,
+		'role': 'HR Manager',
+		'submit': 1,
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'doctype': 'DocPerm',
+		'idx': 4,
+		'permlevel': 1,
+		'role': 'HR User'
+	},
+
+	# DocPerm
+	{
+		'doctype': 'DocPerm',
+		'idx': 5,
+		'permlevel': 1,
+		'role': 'HR Manager'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Section Break',
+		'idx': 1,
+		'label': 'Basic Info',
+		'oldfieldtype': 'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Column Break',
+		'idx': 2,
+		'oldfieldtype': 'Column Break',
+		'permlevel': 0,
+		'width': '50%'
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'employee',
+		'fieldtype': 'Link',
+		'idx': 3,
+		'in_filter': 1,
+		'label': 'Employee',
+		'oldfieldname': 'employee',
+		'oldfieldtype': 'Link',
+		'options': 'Employee',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'employee_name',
+		'fieldtype': 'Data',
+		'idx': 4,
+		'in_filter': 1,
+		'label': 'Employee Name',
+		'oldfieldname': 'employee_name',
+		'oldfieldtype': 'Data',
+		'permlevel': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'department',
+		'fieldtype': 'Link',
+		'idx': 5,
+		'in_filter': 1,
+		'label': 'Department',
+		'oldfieldname': 'department',
+		'oldfieldtype': 'Link',
+		'options': 'Department',
+		'permlevel': 1,
+		'reqd': 0,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'designation',
+		'fieldtype': 'Link',
+		'idx': 6,
+		'in_filter': 1,
+		'label': 'Designation',
+		'oldfieldname': 'designation',
+		'oldfieldtype': 'Link',
+		'options': 'Designation',
+		'permlevel': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'branch',
+		'fieldtype': 'Link',
+		'idx': 7,
+		'in_filter': 1,
+		'label': 'Branch',
+		'oldfieldname': 'branch',
+		'oldfieldtype': 'Link',
+		'options': 'Branch',
+		'permlevel': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'grade',
+		'fieldtype': 'Link',
+		'idx': 8,
+		'in_filter': 1,
+		'label': 'Grade',
+		'oldfieldname': 'grade',
+		'oldfieldtype': 'Link',
+		'options': 'Grade',
+		'permlevel': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'pf_no',
+		'fieldtype': 'Data',
+		'idx': 9,
+		'label': 'PF No.',
+		'oldfieldname': 'pf_no',
+		'oldfieldtype': 'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'esic_no',
+		'fieldtype': 'Data',
+		'idx': 10,
+		'label': 'ESIC No.',
+		'oldfieldname': 'esic_no',
+		'oldfieldtype': 'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'letter_head',
+		'fieldtype': 'Link',
+		'idx': 11,
+		'label': 'Letter Head',
+		'options': 'Letter Head',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Column Break',
+		'idx': 12,
+		'oldfieldtype': 'Column Break',
+		'permlevel': 0,
+		'width': '50%'
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'fiscal_year',
+		'fieldtype': 'Link',
+		'idx': 13,
+		'in_filter': 1,
+		'label': 'Fiscal Year',
+		'oldfieldname': 'fiscal_year',
+		'oldfieldtype': 'Data',
+		'options': 'Fiscal Year',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'company',
+		'fieldtype': 'Select',
+		'idx': 14,
+		'in_filter': 1,
+		'label': 'Company',
+		'options': 'link:Company',
+		'permlevel': 0,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'month',
+		'fieldtype': 'Select',
+		'idx': 15,
+		'in_filter': 1,
+		'label': 'Month',
+		'oldfieldname': 'month',
+		'oldfieldtype': 'Select',
+		'options': '\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12',
+		'permlevel': 0,
+		'reqd': 1,
+		'search_index': 1,
+		'trigger': 'Client',
+		'width': '37%'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'total_days_in_month',
+		'fieldtype': 'Data',
+		'idx': 16,
+		'label': 'Total days in month',
+		'oldfieldname': 'total_days_in_month',
+		'oldfieldtype': 'Int',
+		'permlevel': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'leave_without_pay',
+		'fieldtype': 'Currency',
+		'idx': 17,
+		'label': 'Leave Without Pay',
+		'oldfieldname': 'leave_without_pay',
+		'oldfieldtype': 'Currency',
+		'permlevel': 0,
+		'trigger': 'Client'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'payment_days',
+		'fieldtype': 'Float',
+		'idx': 18,
+		'label': 'Payment days',
+		'oldfieldname': 'payment_days',
+		'oldfieldtype': 'Float',
+		'permlevel': 1,
+		'reqd': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'bank_name',
+		'fieldtype': 'Data',
+		'idx': 19,
+		'label': 'Bank Name',
+		'oldfieldname': 'bank_name',
+		'oldfieldtype': 'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'bank_account_no',
+		'fieldtype': 'Data',
+		'idx': 20,
+		'label': 'Bank Account No.',
+		'oldfieldname': 'bank_account_no',
+		'oldfieldtype': 'Data',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'email_check',
+		'fieldtype': 'Check',
+		'idx': 21,
+		'label': 'Email',
+		'no_copy': 1,
+		'oldfieldname': 'email_check',
+		'oldfieldtype': 'Check',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'amended_from',
+		'fieldtype': 'Data',
+		'hidden': 0,
+		'idx': 22,
+		'label': 'Amended From',
+		'no_copy': 1,
+		'oldfieldname': 'amended_from',
+		'oldfieldtype': 'Data',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'amendment_date',
+		'fieldtype': 'Date',
+		'hidden': 0,
+		'idx': 23,
+		'label': 'Amendment Date',
+		'no_copy': 1,
+		'oldfieldname': 'amendment_date',
+		'oldfieldtype': 'Date',
+		'permlevel': 0,
+		'print_hide': 1,
+		'report_hide': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Section Break',
+		'idx': 24,
+		'label': 'Earning & Deduction',
+		'oldfieldtype': 'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldtype': 'Column Break',
+		'idx': 25,
+		'label': 'Earning',
+		'oldfieldtype': 'Column Break',
+		'permlevel': 0,
+		'reqd': 0,
+		'width': '50%'
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'earning_details',
+		'fieldtype': 'Table',
+		'idx': 26,
+		'label': 'Earning Details',
+		'oldfieldname': 'earning_details',
+		'oldfieldtype': 'Table',
+		'options': 'SS Earning Detail',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldtype': 'Column Break',
+		'idx': 27,
+		'label': 'Deduction',
+		'oldfieldtype': 'Column Break',
+		'permlevel': 0,
+		'width': '50%'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'deduction_details',
+		'fieldtype': 'Table',
+		'idx': 28,
+		'label': 'Deduction Details',
+		'oldfieldname': 'deduction_details',
+		'oldfieldtype': 'Table',
+		'options': 'SS Deduction Detail',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Section Break',
+		'idx': 29,
+		'label': 'Totals',
+		'oldfieldtype': 'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Column Break',
+		'idx': 30,
+		'oldfieldtype': 'Column Break',
+		'permlevel': 0,
+		'width': '50%'
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'arrear_amount',
+		'fieldtype': 'Currency',
+		'idx': 31,
+		'label': 'Arrear Amount',
+		'oldfieldname': 'arrear_amount',
+		'oldfieldtype': 'Currency',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'doctype': 'DocField',
+		'fieldname': 'leave_encashment_amount',
+		'fieldtype': 'Currency',
+		'idx': 32,
+		'label': 'Leave Encashment Amount',
+		'oldfieldname': 'encashment_amount',
+		'oldfieldtype': 'Currency',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'gross_pay',
+		'fieldtype': 'Currency',
+		'idx': 33,
+		'label': 'Gross Pay',
+		'oldfieldname': 'gross_pay',
+		'oldfieldtype': 'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'total_deduction',
+		'fieldtype': 'Currency',
+		'idx': 34,
+		'label': 'Total Deduction',
+		'oldfieldname': 'total_deduction',
+		'oldfieldtype': 'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldtype': 'Column Break',
+		'idx': 35,
+		'oldfieldtype': 'Column Break',
+		'permlevel': 0,
+		'width': '50%'
+	},
+
+	# DocField
+	{
+		'colour': 'White:FFF',
+		'description': 'Gross Pay + Arrear Amount +Encashment Amount - Total Deduction',
+		'doctype': 'DocField',
+		'fieldname': 'net_pay',
+		'fieldtype': 'Currency',
+		'idx': 36,
+		'label': 'Net Pay',
+		'oldfieldname': 'net_pay',
+		'oldfieldtype': 'Currency',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
+		'fieldname': 'rounded_total',
+		'fieldtype': 'Currency',
+		'idx': 37,
+		'label': 'Rounded Total',
+		'permlevel': 1
+	},
+
+	# DocField
+	{
+		'description': 'Net Pay (in words) will be visible once you save the Salary Slip.',
+		'doctype': 'DocField',
+		'fieldname': 'total_in_words',
+		'fieldtype': 'Data',
+		'idx': 38,
+		'label': 'Total in words',
+		'oldfieldname': 'net_pay_in_words',
+		'oldfieldtype': 'Data',
+		'permlevel': 1
+	}
+]
\ No newline at end of file
diff --git a/patches/erpnext_structure_cleanup.py b/patches/erpnext_structure_cleanup.py
index 8b765de..e78a82e 100644
--- a/patches/erpnext_structure_cleanup.py
+++ b/patches/erpnext_structure_cleanup.py
@@ -195,6 +195,6 @@
 	sync_mapper()
 	delete_unwanted_modules()
 	# landed cost wizard link in stock
-	reload_doc('stock', 'Module Def', 'stock')
+	reload_doc('stock', 'Module Def', 'Stock')
 	
 	sql("commit")
diff --git a/patches/patch.py b/patches/patch.py
index 0ceb2a7..13da883 100644
--- a/patches/patch.py
+++ b/patches/patch.py
@@ -1,7 +1,7 @@
 # REMEMBER to update this
 # ========================
 
-last_patch = 330
+last_patch = 332
 
 #-------------------------------------------
 
@@ -1346,3 +1346,5 @@
 		# permission
 		p.add_permission('Lease Agreement', 'Accounts Manager', 0, read = 1, write=1,submit=1, cancel=1,amend=1)
 		p.add_permission('Lease Agreement', 'Accounts Manager', 1, read = 1)
+	elif patch_no == 332:
+		sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'")
diff --git a/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt b/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt
index fb99862..155d3da 100644
--- a/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt
+++ b/utilities/doctype/bulk_rename_tool/bulk_rename_tool.txt
@@ -3,16 +3,16 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2011-07-08 11:14:15',
+		'creation': '2011-07-07 17:47:52',
 		'docstatus': 0,
-		'modified': '2011-07-26 00:59:27',
+		'modified': '2011-07-27 13:19:22',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1310035501',
+		'_last_update': '1311622167',
 		'allow_attach': 1,
 		'autoname': 'field:rename_doctype',
 		'colour': 'White:FFF',
@@ -21,7 +21,7 @@
 		'name': '__common__',
 		'section_style': 'Simple',
 		'show_in_menu': 0,
-		'version': 6
+		'version': 7
 	},
 
 	# These values are common for all DocField