Merge branch 'master' of github.com:webnotes/erpnext
diff --git "a/accounts/TDS Rate Chart/Rate chart \05001-07-2010\051/Rate chart \05001-07-2010\051.txt" "b/accounts/TDS Rate Chart/Rate chart \05001-07-2010\051/Rate chart \05001-07-2010\051.txt"
deleted file mode 100644
index 1949eb6..0000000
--- "a/accounts/TDS Rate Chart/Rate chart \05001-07-2010\051/Rate chart \05001-07-2010\051.txt"
+++ /dev/null
@@ -1 +0,0 @@
-[{'applicable_from': '2010-07-01', 'modified_by': 'sneha@webnotestech.com', 'name': 'Rate chart (01-07-2010)', 'parent': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'module': 'Accounts', 'doctype': 'TDS Rate Chart', 'fiscal_year': None, 'idx': None, 'parenttype': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'applicable_to': None, 'parentfield': None}, {'category': 'Professional Fees - 194J - for Companies', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008839', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 1, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 10.0, 'slab_from': 30000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Professional Fees - 194J - for Individuals', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008840', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 2, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 10.0, 'slab_from': 30000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Contractors - 194C - for Companies', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008841', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 3, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 2.0, 'slab_from': 30000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Contractors - 194C - for Individuals', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008842', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 4, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 1.0, 'slab_from': 30000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Other Interest - for Individuals', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008843', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 5, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 10.0, 'slab_from': 5000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Pay to Advt Or Sub Contr - for Companies', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008844', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 6, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 2.0, 'slab_from': 30000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Pay to Advt Or Sub Contr - for Individuals', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008845', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 7, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 1.0, 'slab_from': 30000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Commission Brokerage - for Companies', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008846', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 8, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 10.0, 'slab_from': 5000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Commission Brokerage - for Individuals', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008847', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 9, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 10.0, 'slab_from': 5000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Rent - for Companies', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008848', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 10, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 10.0, 'slab_from': 180000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Rent - for Individuals', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008849', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 11, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 10.0, 'slab_from': 180000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'TDS on ECB Loan', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008850', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 12, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 10.0, 'slab_from': 5000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'TDS on Rent (Machinery)', 'slab_to': None, 'modified_by': 'sneha@webnotestech.com', 'name': '000008851', 'parent': 'Rate chart (01-07-2010)', 'total_rate': None, 'creation': '2010-06-30 14:48:57', 'modified': '2010-10-04 17:24:25', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 13, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': 20.0, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 2.0, 'slab_from': 180000.0, 'parentfield': 'rate_chart_detail'}]
\ No newline at end of file
diff --git a/accounts/TDS Rate Chart/TDS Rate Chart October 2009 Onwards/TDS Rate Chart October 2009 Onwards.txt b/accounts/TDS Rate Chart/TDS Rate Chart October 2009 Onwards/TDS Rate Chart October 2009 Onwards.txt
deleted file mode 100644
index 0dfcd95..0000000
--- a/accounts/TDS Rate Chart/TDS Rate Chart October 2009 Onwards/TDS Rate Chart October 2009 Onwards.txt
+++ /dev/null
@@ -1 +0,0 @@
-[{'applicable_from': '2009-10-01', 'modified_by': 'nabin@webnotestech.com', 'name': 'TDS Rate Chart October 2009 Onwards', 'parent': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'module': 'Accounts', 'doctype': 'TDS Rate Chart', 'fiscal_year': None, 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'applicable_to': '2010-03-31', 'parentfield': None}, {'category': 'Professional Fees - 194J - for Companies', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002625', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 1, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Professional Fees - 194J - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002627', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 2, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Contractors - 194C - for Companies', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002629', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 3, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 2.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Contractors - 194C - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002631', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 4, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 1.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Other Interest - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002633', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 5, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 5000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Pay to Advt Or Sub Contr - for Companies', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002635', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 6, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 2.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Pay to Advt Or Sub Contr - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002637', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 7, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 1.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Commission Brokerage - for Companies', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002639', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 8, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 2500.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Commission Brokerage - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002641', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 9, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 2500.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Rent - for Companies', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002643', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 10, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 120000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Rent - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002645', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 11, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 120000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'TDS on ECB Loan', 'slab_to': 10000000.0, 'modified_by': 'nabin@webnotestech.com', 'name': '000002646', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2009-10-05 11:32:56', 'modified': '2010-05-26 16:01:54', 'ec': 0.0, 'doctype': 'TDS Rate Detail', 'shec': 0.0, 'idx': 12, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 5000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'TDS on Rent (Machinery)', 'slab_to': None, 'modified_by': 'nabin@webnotestech.com', 'name': '000007335', 'parent': 'TDS Rate Chart October 2009 Onwards', 'total_rate': None, 'creation': '2010-05-26 16:01:54', 'modified': '2010-05-26 16:01:54', 'ec': None, 'doctype': 'TDS Rate Detail', 'shec': None, 'idx': 13, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': None, 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'rate': 2.0, 'slab_from': 120000.0, 'parentfield': 'rate_chart_detail'}]
\ No newline at end of file
diff --git a/accounts/TDS Rate Chart/TDS Rate Chart for 2009-10/TDS Rate Chart for 2009-10.txt b/accounts/TDS Rate Chart/TDS Rate Chart for 2009-10/TDS Rate Chart for 2009-10.txt
deleted file mode 100644
index 14ce215..0000000
--- a/accounts/TDS Rate Chart/TDS Rate Chart for 2009-10/TDS Rate Chart for 2009-10.txt
+++ /dev/null
@@ -1 +0,0 @@
-[{'applicable_from': '2008-01-01', 'modified_by': 'Administrator', 'name': 'TDS Rate Chart for 2009-10', 'parent': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'module': 'Accounts', 'doctype': 'TDS Rate Chart', 'fiscal_year': None, 'idx': None, 'parenttype': None, 'owner': 'Administrator', 'docstatus': 0, 'applicable_to': '2009-09-30', 'parentfield': None}, {'category': 'Professional Fees - 194J - for Companies', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001291', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 1, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': None, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Professional Fees - 194J - for Companies', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000001292', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 2, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 1.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Professional Fees - 194J - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001293', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 3, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': None, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Professional Fees - 194J - for Individuals', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000001294', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 4, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 1.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Contractors - 194C - for Companies', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001295', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.040000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.02, 'idx': 5, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': None, 'owner': 'Administrator', 'docstatus': 0, 'rate': 2.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Contractors - 194C - for Companies', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000001296', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.040000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.02, 'idx': 6, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.20000000000000001, 'owner': 'Administrator', 'docstatus': 0, 'rate': 2.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Contractors - 194C - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001297', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.02, 'doctype': 'TDS Rate Detail', 'shec': 0.01, 'idx': 7, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': None, 'owner': 'Administrator', 'docstatus': 0, 'rate': 1.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Contractors - 194C - for Individuals', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000001298', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.02, 'doctype': 'TDS Rate Detail', 'shec': 0.01, 'idx': 8, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.10000000000000001, 'owner': 'Administrator', 'docstatus': 0, 'rate': 1.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Other Interest - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001299', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 9, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': None, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 5000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Other Interest - for Individuals', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000001300', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 10, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 1.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Pay to Advt Or Sub Contr - for Companies', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001301', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.040000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.02, 'idx': 11, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 2.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Pay to Advt Or Sub Contr - for Companies', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000001302', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.040000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.02, 'idx': 12, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.20000000000000001, 'owner': 'Administrator', 'docstatus': 0, 'rate': 2.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Pay to Advt Or Sub Contr - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001303', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.02, 'doctype': 'TDS Rate Detail', 'shec': 0.01, 'idx': 13, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 1.0, 'slab_from': 20000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Pay to Advt Or Sub Contr - for Individuals', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000001304', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.02, 'doctype': 'TDS Rate Detail', 'shec': 0.01, 'idx': 14, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.10000000000000001, 'owner': 'Administrator', 'docstatus': 0, 'rate': 1.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Commission Brokerage - for Companies', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001305', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 15, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 2500.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Commission Brokerage - for Companies', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000001306', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 16, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 1.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Commission Brokerage - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001307', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 17, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': None, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 2500.0, 'parentfield': 'rate_chart_detail'}, {'category': 'Commission Brokerage - for Individuals', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000001308', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 18, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 1.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Rent - for Companies', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001309', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 19, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 120000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Rent - for Companies', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000001310', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 20, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 1.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Rent - for Individuals', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001311', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-09 11:04:46', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 21, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 120000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'T.D.S on Rent - for Individuals', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000002623', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-10-05 11:05:18', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 22, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 1.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'TDS on ECB Loan', 'slab_to': 10000000.0, 'modified_by': 'Administrator', 'name': '000001390', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-07-17 16:32:35', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 23, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 0.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 5000.0, 'parentfield': 'rate_chart_detail'}, {'category': 'TDS on ECB Loan', 'slab_to': 100000000.0, 'modified_by': 'Administrator', 'name': '000002624', 'parent': 'TDS Rate Chart for 2009-10', 'total_rate': None, 'creation': '2009-10-05 11:05:18', 'modified': '2009-10-05 11:27:31', 'ec': 0.20000000000000001, 'doctype': 'TDS Rate Detail', 'shec': 0.10000000000000001, 'idx': 24, 'parenttype': 'TDS Rate Chart', 'rate_without_pan': None, 'surcharge': 1.0, 'owner': 'Administrator', 'docstatus': 0, 'rate': 10.0, 'slab_from': 10000000.0, 'parentfield': 'rate_chart_detail'}]
\ No newline at end of file
diff --git a/accounts/doctype/form_16a/__init__.py b/accounts/doctype/form_16a/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/form_16a/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/form_16a/form_16a.js b/accounts/doctype/form_16a/form_16a.js
deleted file mode 100644
index 503681b..0000000
--- a/accounts/doctype/form_16a/form_16a.js
+++ /dev/null
@@ -1,48 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.cscript.onload = function(doc,cdt,cdn){
-  if(doc.company)get_server_fields('get_registration_details','','',doc,cdt,cdn,1);
-}
-
-cur_frm.cscript.company = function(doc,cdt,cdn){
-  if(doc.company)get_server_fields('get_registration_details','','',doc,cdt,cdn);
-}
-
-cur_frm.fields_dict['party_name'].get_query = function(doc, cdt, cdn) {
-  return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.master_type = "Supplier" AND `tabAccount`.docstatus != 2 AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50';
-}
-
-cur_frm.cscript.party_name = function(doc,cdt,cdn){
-  if(doc.party_name)get_server_fields('get_party_det','','',doc,cdt,cdn);
-}
-
-// Date validation
-cur_frm.cscript.to_date = function(doc,cdt,cdn){
-  if((doc.from_date) && (doc.to_date) && (doc.from_date>doc.to_date)){
-    alert("From date can not be greater than To date");
-    doc.to_date='';
-    refresh_field('to_date');
-  }
-}
-
-cur_frm.cscript.from_date = function(doc,cdt,cdn){
-  if((doc.from_date) && (doc.to_date) && (doc.from_date>doc.to_date)){
-    alert("From date can not be greater than To date");
-    doc.from_date='';
-    refresh_field('from_date');
-  }
-}
\ No newline at end of file
diff --git a/accounts/doctype/form_16a/form_16a.py b/accounts/doctype/form_16a/form_16a.py
deleted file mode 100644
index 4afd361..0000000
--- a/accounts/doctype/form_16a/form_16a.py
+++ /dev/null
@@ -1,120 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-from webnotes.utils import cstr, flt, now
-from webnotes.model import db_exists
-from webnotes.model.doc import addchild, make_autoname
-from webnotes.model.wrapper import getlist, copy_doclist
-from webnotes.model.code import get_obj
-from webnotes import form, msgprint
-
-sql = webnotes.conn.sql
-	
-from utilities.transaction_base import TransactionBase
-
-class DocType(TransactionBase):
-	def __init__(self,d,dl):
-		self.doc, self.doclist = d, dl
-	
-	def autoname(self):
-		self.doc.name = make_autoname('Form 16A' + '/.#####') 
-
-	# Get pan no and tan no from company
-	#-------------------------------------
-	def get_registration_details(self):
-		comp_det=sql("Select address,registration_details from `tabCompany` where name = '%s'"%(self.doc.company))
-		if not comp_det:
-			msgprint("Registration Details is not mentioned in comapny")
-			ret = {
-			'company_address':'',
-			'registration_details':	''
-		}
-		else:
-			ret = {
-				'company_address': cstr(comp_det[0][0]),
-				'registration_details': cstr(comp_det[0][1])
-			}	 
-		return ret
-    
-	# Get party details
-	#------------------
-	def get_party_det(self):		
-		party_det=sql("select master_type, master_name from `tabAccount` where name='%s'" % self.doc.party_name)
-		if party_det and party_det[0][0]=='Supplier':			
-			try:
-				rec = sql("select name, address_line1, address_line2, city, country, pincode, state from `tabAddress` where supplier = '%s' and docstatus != 2 order by is_primary_address desc limit 1" %(party_det[0][1]), as_dict = 1)
-				address_display = cstr((rec[0]['address_line1'] and rec[0]['address_line1'] or '')) + cstr((rec[0]['address_line2'] and '\n' + rec[0]['address_line2'] or '')) + cstr((rec[0]['city'] and '\n'+rec[0]['city'] or '')) + cstr((rec[0]['pincode'] and '\n' + rec[0]['pincode'] or '')) + cstr((rec[0]['state'] and '\n'+rec[0]['state'] or '')) + cstr((rec[0]['country'] and '\n'+rec[0]['country'] or ''))
-			except:
-				address_display = ''
-				
-		ret = {
-			'party_address': cstr(address_display)
-		}
-          	
-		return ret
-	
-	# Get TDS Return acknowledgement
-	#-------------------------------
-	def get_return_ack_details(self):
-		self.doclist = self.doc.clear_table(self.doclist, 'form_16A_ack_details')
-		if not (self.doc.from_date and self.doc.to_date):
-			msgprint("Please enter From Date, To Date")
-		else:
-			ack = sql("select quarter, acknowledgement_no from `tabTDS Return Acknowledgement` where date_of_receipt>='%s' and date_of_receipt<='%s' and tds_category = '%s' order by date_of_receipt ASC" % (self.doc.from_date, self.doc.to_date, self.doc.tds_category))
-			for d in ack:
-				ch = addchild(self.doc, 'form_16A_ack_details', 'Form 16A Ack Detail', 1, self.doclist)
-				ch.quarter = d[0]
-				ch.ack_no = d[1]
-
-	# Get tds payment details
-	#-------------------------------
-	def get_tds(self):
-		self.doclist = self.doc.clear_table(self.doclist,'form_16A_tax_details')
-		import datetime
-		if self.doc.from_date and self.doc.to_date and self.doc.tds_category:			
-			tot=0.0
-			party_tds_list=sql("select t2.amount_paid,t2.date_of_payment,t2.tds_amount,t2.cess_on_tds, t2.total_tax_amount, t1.cheque_no, t1.bsr_code, t1.date_of_receipt, t1.challan_id from `tabTDS Payment` t1, `tabTDS Payment Detail` t2 where t1.tds_category='%s' and t2.party_name='%s' and t1.from_date >= '%s' and t1.to_date <= '%s' and t2.total_tax_amount>0 and t2.parent=t1.name and t1.docstatus=1" % (self.doc.tds_category,self.doc.party_name,self.doc.from_date,self.doc.to_date))
-			for s in party_tds_list:
-				child = addchild(self.doc, 'form_16A_tax_details', 'Form 16A Tax Detail', 1, self.doclist)
-				child.amount_paid = s and flt(s[0]) or ''
-				child.date_of_payment =s and s[1].strftime('%Y-%m-%d') or ''
-				child.tds_main = s and flt(s[2]) or ''
-				child.surcharge = 0
-				child.cess_on_tds = s and flt(s[3]) or ''
-				child.total_tax_deposited = s and flt(s[4]) or ''
-				child.cheque_no = s and s[5] or ''
-				child.bsr_code = s and s[6] or ''
-				child.tax_deposited_date = s and s[7].strftime('%Y-%m-%d') or ''
-				child.challan_no = s and s[8] or ''
-				tot=flt(tot)+flt(s[4])
-			self.doc.total_amount = flt(tot)
-		else:
-			msgprint("Plaese enter from date, to date and TDS category")
-		
-	
-	# validate
-	#----------------
-	def validate(self):
-		tot=0.0
-		for d in getlist(self.doclist,'form_16A_tax_details'):
-			tot=flt(tot)+flt(d.total_tax_deposited)
-		
-		dcc = TransactionBase().get_company_currency(self.doc.company)
-		self.doc.total_amount = flt(tot)		
-		self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.total_amount)
diff --git a/accounts/doctype/form_16a/form_16a.txt b/accounts/doctype/form_16a/form_16a.txt
deleted file mode 100644
index 0104311..0000000
--- a/accounts/doctype/form_16a/form_16a.txt
+++ /dev/null
@@ -1,344 +0,0 @@
-[
- {
-  "owner": "Administrator", 
-  "docstatus": 0, 
-  "creation": "2012-07-03 13:29:51", 
-  "modified_by": "Administrator", 
-  "modified": "2012-12-03 17:10:41"
- }, 
- {
-  "in_create": 0, 
-  "doctype": "DocType", 
-  "module": "Accounts", 
-  "name": "__common__"
- }, 
- {
-  "name": "__common__", 
-  "parent": "Form 16A", 
-  "doctype": "DocField", 
-  "parenttype": "DocType", 
-  "parentfield": "fields"
- }, 
- {
-  "name": "__common__", 
-  "parent": "Form 16A", 
-  "read": 1, 
-  "doctype": "DocPerm", 
-  "parenttype": "DocType", 
-  "parentfield": "permissions"
- }, 
- {
-  "name": "Form 16A", 
-  "doctype": "DocType"
- }, 
- {
-  "oldfieldtype": "Column Break", 
-  "doctype": "DocField", 
-  "width": "50%", 
-  "fieldname": "column_break0", 
-  "fieldtype": "Column Break", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Date", 
-  "doctype": "DocField", 
-  "label": "From Date", 
-  "oldfieldname": "from_date", 
-  "fieldname": "from_date", 
-  "fieldtype": "Date", 
-  "reqd": 1, 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Date", 
-  "doctype": "DocField", 
-  "label": "To Date", 
-  "oldfieldname": "to_date", 
-  "trigger": "Client", 
-  "fieldname": "to_date", 
-  "fieldtype": "Date", 
-  "reqd": 1, 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Link", 
-  "colour": "White:FFF", 
-  "doctype": "DocField", 
-  "label": "TDS Category", 
-  "oldfieldname": "tds_category", 
-  "options": "TDS Category", 
-  "fieldname": "tds_category", 
-  "fieldtype": "Link", 
-  "reqd": 1, 
-  "permlevel": 0, 
-  "in_filter": 1
- }, 
- {
-  "oldfieldtype": "Link", 
-  "colour": "White:FFF", 
-  "doctype": "DocField", 
-  "label": "Party Name", 
-  "oldfieldname": "party_name", 
-  "permlevel": 0, 
-  "trigger": "Client", 
-  "fieldname": "party_name", 
-  "fieldtype": "Link", 
-  "reqd": 1, 
-  "hidden": 0, 
-  "options": "Account", 
-  "in_filter": 1
- }, 
- {
-  "oldfieldtype": "Small Text", 
-  "doctype": "DocField", 
-  "label": "Address", 
-  "oldfieldname": "party_address", 
-  "fieldname": "party_address", 
-  "fieldtype": "Small Text", 
-  "reqd": 0, 
-  "permlevel": 1
- }, 
- {
-  "oldfieldtype": "Data", 
-  "doctype": "DocField", 
-  "label": "PAN No", 
-  "oldfieldname": "pan_number", 
-  "fieldname": "pan_number", 
-  "fieldtype": "Data", 
-  "hidden": 0, 
-  "permlevel": 1
- }, 
- {
-  "oldfieldtype": "Column Break", 
-  "doctype": "DocField", 
-  "width": "50%", 
-  "fieldname": "column_break1", 
-  "fieldtype": "Column Break", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Select", 
-  "doctype": "DocField", 
-  "label": "Fiscal Year", 
-  "oldfieldname": "fiscal_year", 
-  "options": "link:Fiscal Year", 
-  "fieldname": "fiscal_year", 
-  "fieldtype": "Select", 
-  "reqd": 1, 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Link", 
-  "doctype": "DocField", 
-  "label": "Company ", 
-  "oldfieldname": "company", 
-  "options": "Company", 
-  "fieldname": "company", 
-  "fieldtype": "Link", 
-  "search_index": 1, 
-  "reqd": 1, 
-  "permlevel": 0, 
-  "in_filter": 1
- }, 
- {
-  "oldfieldtype": "Small Text", 
-  "doctype": "DocField", 
-  "label": "Company Address", 
-  "oldfieldname": "company_address", 
-  "fieldname": "company_address", 
-  "fieldtype": "Small Text", 
-  "permlevel": 1
- }, 
- {
-  "oldfieldtype": "Small Text", 
-  "doctype": "DocField", 
-  "label": "Registration Details", 
-  "oldfieldname": "registration_details", 
-  "fieldname": "registration_details", 
-  "fieldtype": "Small Text", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Section Break", 
-  "doctype": "DocField", 
-  "label": "Return Details", 
-  "fieldname": "return_details", 
-  "fieldtype": "Section Break", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Button", 
-  "doctype": "DocField", 
-  "label": "Get Return Details", 
-  "options": "get_return_ack_details", 
-  "fieldname": "get_return_details", 
-  "fieldtype": "Button", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Table", 
-  "doctype": "DocField", 
-  "label": "Form 16A Ack Details", 
-  "oldfieldname": "form_16A_ack_details", 
-  "options": "Form 16A Ack Detail", 
-  "fieldname": "form_16A_ack_details", 
-  "fieldtype": "Table", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Section Break", 
-  "doctype": "DocField", 
-  "label": "Payment Details", 
-  "fieldname": "payment_details", 
-  "fieldtype": "Section Break", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Button", 
-  "doctype": "DocField", 
-  "label": "Get TDS", 
-  "options": "get_tds", 
-  "fieldname": "get_tds", 
-  "fieldtype": "Button", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Table", 
-  "colour": "White:FFF", 
-  "doctype": "DocField", 
-  "label": "Tax Details", 
-  "oldfieldname": "form_16A_tax_details", 
-  "options": "Form 16A Tax Detail", 
-  "fieldname": "form_16A_tax_details", 
-  "fieldtype": "Table", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Currency", 
-  "doctype": "DocField", 
-  "label": "Total Amount", 
-  "oldfieldname": "total_amount", 
-  "fieldname": "total_amount", 
-  "fieldtype": "Currency", 
-  "permlevel": 0
- }, 
- {
-  "doctype": "DocField", 
-  "label": "In Words", 
-  "fieldname": "in_words", 
-  "fieldtype": "Data", 
-  "permlevel": 1
- }, 
- {
-  "oldfieldtype": "Section Break", 
-  "doctype": "DocField", 
-  "options": "Simple", 
-  "fieldname": "section_break0", 
-  "fieldtype": "Section Break", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Column Break", 
-  "doctype": "DocField", 
-  "width": "50%", 
-  "fieldname": "column_break2", 
-  "fieldtype": "Column Break", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Data", 
-  "doctype": "DocField", 
-  "label": "Place", 
-  "oldfieldname": "place", 
-  "fieldname": "place", 
-  "fieldtype": "Data", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Date", 
-  "doctype": "DocField", 
-  "label": "Date", 
-  "oldfieldname": "dt", 
-  "fieldname": "dt", 
-  "fieldtype": "Date", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Column Break", 
-  "doctype": "DocField", 
-  "width": "50%", 
-  "fieldname": "column_break3", 
-  "fieldtype": "Column Break", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Data", 
-  "doctype": "DocField", 
-  "label": "Full Name", 
-  "oldfieldname": "full_name", 
-  "fieldname": "full_name", 
-  "fieldtype": "Data", 
-  "permlevel": 0
- }, 
- {
-  "oldfieldtype": "Data", 
-  "doctype": "DocField", 
-  "label": "Designation", 
-  "oldfieldname": "designation", 
-  "fieldname": "designation", 
-  "fieldtype": "Data", 
-  "permlevel": 0
- }, 
- {
-  "amend": 0, 
-  "create": 0, 
-  "doctype": "DocPerm", 
-  "submit": 0, 
-  "write": 0, 
-  "role": "Accounts Manager", 
-  "cancel": 0, 
-  "permlevel": 1
- }, 
- {
-  "amend": 0, 
-  "create": 1, 
-  "doctype": "DocPerm", 
-  "submit": 0, 
-  "write": 1, 
-  "role": "Accounts Manager", 
-  "cancel": 0, 
-  "permlevel": 0
- }, 
- {
-  "amend": 0, 
-  "create": 0, 
-  "doctype": "DocPerm", 
-  "submit": 0, 
-  "write": 0, 
-  "role": "Accounts User", 
-  "cancel": 0, 
-  "permlevel": 1
- }, 
- {
-  "amend": 0, 
-  "create": 1, 
-  "doctype": "DocPerm", 
-  "submit": 0, 
-  "write": 1, 
-  "role": "Accounts User", 
-  "cancel": 0, 
-  "permlevel": 0
- }, 
- {
-  "create": 1, 
-  "doctype": "DocPerm", 
-  "write": 1, 
-  "role": "System Manager", 
-  "permlevel": 0
- }, 
- {
-  "doctype": "DocPerm", 
-  "role": "System Manager", 
-  "permlevel": 1
- }
-]
\ No newline at end of file
diff --git a/accounts/doctype/form_16a_ack_detail/__init__.py b/accounts/doctype/form_16a_ack_detail/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/form_16a_ack_detail/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/form_16a_ack_detail/form_16a_ack_detail.py b/accounts/doctype/form_16a_ack_detail/form_16a_ack_detail.py
deleted file mode 100644
index 7f48feb..0000000
--- a/accounts/doctype/form_16a_ack_detail/form_16a_ack_detail.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/accounts/doctype/form_16a_ack_detail/form_16a_ack_detail.txt b/accounts/doctype/form_16a_ack_detail/form_16a_ack_detail.txt
deleted file mode 100644
index b3d1546..0000000
--- a/accounts/doctype/form_16a_ack_detail/form_16a_ack_detail.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-# DocType, Form 16A Ack Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:42',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:35:42',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'show_in_menu': 0,
-		'version': 1
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Form 16A Ack Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Form 16A Ack Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Form 16A Ack Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'quarter',
-		'fieldtype': u'Select',
-		'label': u'Quarter',
-		'oldfieldname': u'quarter',
-		'oldfieldtype': u'Select',
-		'options': u'\nApr-Jun\nJul-Sept\nOct-Dec\nJan-Mar'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'ack_no',
-		'fieldtype': u'Data',
-		'label': u'Acknowledgement No.',
-		'oldfieldname': u'ack_no',
-		'oldfieldtype': u'Data'
-	}
-]
\ No newline at end of file
diff --git a/accounts/doctype/form_16a_tax_detail/__init__.py b/accounts/doctype/form_16a_tax_detail/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/form_16a_tax_detail/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/form_16a_tax_detail/form_16a_tax_detail.py b/accounts/doctype/form_16a_tax_detail/form_16a_tax_detail.py
deleted file mode 100644
index 7f48feb..0000000
--- a/accounts/doctype/form_16a_tax_detail/form_16a_tax_detail.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/accounts/doctype/form_16a_tax_detail/form_16a_tax_detail.txt b/accounts/doctype/form_16a_tax_detail/form_16a_tax_detail.txt
deleted file mode 100644
index c0a0c73..0000000
--- a/accounts/doctype/form_16a_tax_detail/form_16a_tax_detail.txt
+++ /dev/null
@@ -1,140 +0,0 @@
-# DocType, Form 16A Tax Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:42',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:35:42',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'show_in_menu': 0,
-		'version': 1
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Form 16A Tax Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Form 16A Tax Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Form 16A Tax Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amount_paid',
-		'fieldtype': u'Currency',
-		'label': u'Amount paid / credited',
-		'oldfieldname': u'amount_paid',
-		'oldfieldtype': u'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'date_of_payment',
-		'fieldtype': u'Date',
-		'label': u'Date of payment / credit',
-		'oldfieldname': u'date_of_payment',
-		'oldfieldtype': u'Date'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tds_main',
-		'fieldtype': u'Currency',
-		'label': u'TDS(Main)',
-		'oldfieldname': u'tds_main',
-		'oldfieldtype': u'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'surcharge',
-		'fieldtype': u'Currency',
-		'label': u'Surcharge',
-		'oldfieldname': u'surcharge',
-		'oldfieldtype': u'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'cess_on_tds',
-		'fieldtype': u'Currency',
-		'label': u'Cess on TDS',
-		'oldfieldname': u'cess_on_tds',
-		'oldfieldtype': u'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'total_tax_deposited',
-		'fieldtype': u'Currency',
-		'label': u'Total Tax Deposited',
-		'oldfieldname': u'total_tax_deposited',
-		'oldfieldtype': u'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'cheque_no',
-		'fieldtype': u'Data',
-		'label': u'Cheque / DD No.',
-		'oldfieldname': u'cheque_no',
-		'oldfieldtype': u'Data'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'bsr_code',
-		'fieldtype': u'Data',
-		'label': u'BSR Code',
-		'oldfieldname': u'bsr_code',
-		'oldfieldtype': u'Data'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tax_deposited_date',
-		'fieldtype': u'Date',
-		'label': u'Tax Deposited Date',
-		'oldfieldname': u'tax_deposited_date',
-		'oldfieldtype': u'Date'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'challan_no',
-		'fieldtype': u'Data',
-		'label': u'Challan No.',
-		'oldfieldname': u'challan_no',
-		'oldfieldtype': u'Data'
-	}
-]
\ No newline at end of file
diff --git a/accounts/doctype/gl_control/gl_control.py b/accounts/doctype/gl_control/gl_control.py
index 0eebf48..a458d03 100644
--- a/accounts/doctype/gl_control/gl_control.py
+++ b/accounts/doctype/gl_control/gl_control.py
@@ -204,7 +204,14 @@
 	# ADVANCE ALLOCATION
 	#-------------------
 	def get_advances(self, obj, account_head, table_name,table_field_name, dr_or_cr):
-		jv_detail = webnotes.conn.sql("select t1.name, t1.remark, t2.%s, t2.name, t1.ded_amount from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t1.name = t2.parent and (t2.against_voucher is null or t2.against_voucher = '') and (t2.against_invoice is null or t2.against_invoice = '') and (t2.against_jv is null or t2.against_jv = '') and t2.account = '%s' and t2.is_advance = 'Yes' and t1.docstatus = 1 order by t1.voucher_date " % (dr_or_cr,account_head))
+		jv_detail = webnotes.conn.sql("""select t1.name, t1.remark, t2.%s, t2.name 
+			from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 
+			where t1.name = t2.parent 
+			and (t2.against_voucher is null or t2.against_voucher = '')
+			and (t2.against_invoice is null or t2.against_invoice = '') 
+			and (t2.against_jv is null or t2.against_jv = '') 
+			and t2.account = '%s' and t2.is_advance = 'Yes' and t1.docstatus = 1 
+			order by t1.voucher_date """ % (dr_or_cr,account_head))
 		# clear advance table
 		obj.doclist = obj.doc.clear_table(obj.doclist,table_field_name)
 		# Create advance table
@@ -215,9 +222,7 @@
 			add.remarks = d[1]
 			add.advance_amount = flt(d[2])
 			add.allocate_amount = 0
-			if table_name == 'Purchase Invoice Advance':
-				add.tds_amount = flt(d[4])
-				
+			
 		return obj.doclist
 
 	# Clear rows which is not adjusted
diff --git a/accounts/doctype/gl_entry/gl_entry.py b/accounts/doctype/gl_entry/gl_entry.py
index 293a2ee..8f6d527 100644
--- a/accounts/doctype/gl_entry/gl_entry.py
+++ b/accounts/doctype/gl_entry/gl_entry.py
@@ -117,23 +117,21 @@
 	def update_outstanding_amt(self):
 		# get final outstanding amt
 		bal = flt(sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled,'No') = 'No'", (self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0)
-		tds = 0
 		
 		if self.doc.against_voucher_type=='Purchase Invoice':
 			# amount to debit
 			bal = -bal
 			
-			# Check if tds applicable
-			tds = sql("select total_tds_on_voucher from `tabPurchase Invoice` where name = '%s'" % self.doc.against_voucher)
-			tds = tds and flt(tds[0][0]) or 0
-		
 		# Validation : Outstanding can not be negative
-		if bal < 0 and not tds and self.doc.is_cancelled == 'No':
-			msgprint("Outstanding for Voucher %s will become %s. Outstanding cannot be less than zero. Please match exact outstanding." % (self.doc.against_voucher, fmt_money(bal)))
+		if bal < 0 and self.doc.is_cancelled == 'No':
+			msgprint("""Outstanding for Voucher %s will become %s. 
+				Outstanding cannot be less than zero. Please match exact outstanding.""" % 
+				 (self.doc.against_voucher, fmt_money(bal)))
 			raise Exception
 			
 		# Update outstanding amt on against voucher
-		sql("update `tab%s` set outstanding_amount=%s where name='%s'"% (self.doc.against_voucher_type,bal,self.doc.against_voucher))
+		sql("update `tab%s` set outstanding_amount=%s where name='%s'"%
+		 	(self.doc.against_voucher_type, bal, self.doc.against_voucher))
 		
 					
 	# Total outstanding can not be greater than credit limit for any time for any customer
diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js
index e05ffc6..784a134 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/accounts/doctype/journal_voucher/journal_voucher.js
@@ -17,10 +17,6 @@
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
 	if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date());
 
-	var cp = wn.control_panel;
-	if(cp.country == 'India') $(cur_frm.fields_dict.tds.row.wrapper).toggle(true);
-	else $(cur_frm.fields_dict.tds.row.wrapper).toggle(false);
-
 	cur_frm.cscript.load_defaults(doc, cdt, cdn);
 }
 
@@ -28,6 +24,9 @@
 	cur_frm.cscript.is_opening(doc)
 	erpnext.hide_naming_series();
 	cur_frm.cscript.voucher_type(doc);
+	if(doc.docstatus==1) { 
+		cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
+	}
 }
 
 cur_frm.cscript.load_defaults = function(doc, cdt, cdn) {
@@ -50,9 +49,6 @@
 cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
 	hide_field('aging_date');
 	if (doc.is_opening == 'Yes') unhide_field('aging_date');
-	
-	if(doc.docstatus==1) { unhide_field('view_ledger_entry'); }
-	else hide_field('view_ledger_entry');
 }
 
 cur_frm.fields_dict['entries'].grid.get_field('account').get_query = function(doc) {
@@ -93,12 +89,6 @@
 		and `tabJournal Voucher Detail`.parent = `tabJournal Voucher`.name";
 }
 
-
-// TDS Account Head
-cur_frm.fields_dict['tax_code'].get_query = function(doc) {
-	return "SELECT `tabTDS Category Account`.account_head FROM `tabTDS Category Account` WHERE `tabTDS Category Account`.parent = '"+doc.tds_category+"' AND `tabTDS Category Account`.company='"+doc.company+"' AND `tabTDS Category Account`.account_head LIKE '%s' ORDER BY `tabTDS Category Account`.account_head DESC LIMIT 50";
-}
-
 //Set debit and credit to zero on adding new row
 //----------------------------------------------
 cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
@@ -139,7 +129,6 @@
 		tc += flt(el[i].credit);
 	}
 	var doc = locals[doc.doctype][doc.name];
-	tc += flt(doc.ded_amount)
 	doc.total_debit = td;
 	doc.total_credit = tc;
 	doc.difference = flt(td - tc);
@@ -148,12 +137,7 @@
 
 cur_frm.cscript.debit = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
 cur_frm.cscript.credit = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
-cur_frm.cscript.ded_amount = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc); }
-cur_frm.cscript.rate = function(doc,dt,dn) {
-	doc.ded_amount = doc.total_debit*doc.rate/100;
-	refresh_field('ded_amount');
-	cur_frm.cscript.update_totals(doc); 
-}
+
 cur_frm.cscript.get_balance = function(doc,dt,dn) {
 	cur_frm.cscript.update_totals(doc); 
 	$c_obj(make_doclist(dt,dn), 'get_balance', '', function(r, rt){
@@ -179,15 +163,6 @@
 	cur_frm.cscript.update_totals(doc);
 }
 
-// TDS
-// --------
-cur_frm.cscript.get_tds = function(doc, dt, dn) {
-	$c_obj(make_doclist(dt,dn), 'get_tds', '', function(r, rt){
-		cur_frm.refresh();
-		cur_frm.cscript.update_totals(doc);
-	});
-}
-
 // ***************** Get Print Heading based on Sales Invoice *****************
 cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
 	return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
@@ -204,7 +179,6 @@
 		cur_frm.pformat.print_heading = "Journal Voucher";
 }
 
-/****************** Get Accounting Entry *****************/
 cur_frm.cscript.view_ledger_entry = function(doc,cdt,cdn){
 	wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);	
 }
diff --git a/accounts/doctype/journal_voucher/journal_voucher.py b/accounts/doctype/journal_voucher/journal_voucher.py
index 8b22f22..23c66a6 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.py
+++ b/accounts/doctype/journal_voucher/journal_voucher.py
@@ -69,8 +69,6 @@
 				if bill_no and bill_no[0][0] and bill_no[0][0].lower().strip() not in ['na', 'not applicable', 'none']:
 					bill_no = bill_no and bill_no[0]
 					r.append('%s %s against Bill %s dated %s' % (bill_no[2] and cstr(bill_no[2]) or '', fmt_money(flt(d.debit)), bill_no[0], bill_no[1] and formatdate(bill_no[1].strftime('%Y-%m-%d')) or ''))
-		if self.doc.ded_amount:
-			r.append("TDS Amount: %s" % self.doc.ded_amount)
 	
 		if self.doc.user_remark:
 			r.append("User Remark : %s"%self.doc.user_remark)
@@ -156,58 +154,7 @@
 				master_type = self.get_master_type(d.account)
 				if (master_type == 'Customer' and flt(d.credit) > 0) or (master_type == 'Supplier' and flt(d.debit) > 0):
 					msgprint("Message: Please check Is Advance as 'Yes' against Account %s if this is an advance entry." % d.account)
-			
-	def get_tds_category_account(self):
-		for d in getlist(self.doclist,'entries'):
-			if flt(d.debit) > 0 and not d.against_voucher and d.is_advance == 'Yes':
-				acc = sql("select tds_applicable from `tabAccount` where name = '%s'" % d.account)
-				acc_tds_applicable = acc and acc[0][0] or 'No'
-				if acc_tds_applicable == 'Yes':
-					# TDS applicable field become mandatory for advance payment towards supplier or related party
-					if not self.doc.tds_applicable:
-						msgprint("Please select TDS Applicable or Not")
-						raise Exception
-						
-					# If TDS applicable, category and supplier account bocome mandatory
-					elif self.doc.tds_applicable == 'Yes':
-						self.validate_category_account(d.account)
-						if self.doc.ded_amount and not self.doc.tax_code:
-							msgprint("Please enter Tax Code in TDS section")
-							raise Exception
-
-					#If TDS not applicable, all related fields should blank
-					else:
-						self.set_fields_null()
-						
-				# If tds amount but tds applicability not mentioned in account master
-				elif self.doc.ded_amount:
-					msgprint("Please select TDS Applicable = 'Yes' in account head: '%s' if you want to deduct TDS." % self.doc.supplier_account)
-					raise Exception
-		
-	def validate_category_account(self, credit_account):
-		if not self.doc.tds_category:
-			msgprint("Please select TDS Category")
-			raise Exception
-			
-		if not self.doc.supplier_account:
-			self.doc.supplier_account = credit_account
-		elif self.doc.supplier_account and self.doc.supplier_account != credit_account:
-			msgprint("Supplier Account is not matching with the account mentioned in the table. Please select proper Supplier Account and click on 'Get TDS' button.")
-			raise Exception
-		
-	def set_fields_null(self):
-		self.doc.ded_amount = 0
-		self.doc.rate = 0
-		self.doc.tax_code = ''
-		self.doc.tds_category = ''
-		self.doc.supplier_account = ''
-		
-	def get_tds(self):
-		if cstr(self.doc.is_opening) != 'Yes':
-			if self.doc.total_debit > 0:
-				self.get_tds_category_account()
-				if self.doc.supplier_account and self.doc.tds_category:
-					get_obj('TDS Control').get_tds_amount(self)					
+				
 
 	def get_balance(self):
 		if not getlist(self.doclist,'entries'):
@@ -238,9 +185,6 @@
 				self.doc.total_debit += flt(d.debit)
 				self.doc.total_credit += flt(d.credit)
 
-			if self.doc.tds_applicable == 'Yes':
-				self.doc.total_credit = flt(self.doc.total_credit) + flt(self.doc.ded_amount)
-
 			self.doc.difference = flt(self.doc.total_debit) - flt(self.doc.total_credit)
 			
 	def get_against_account(self):
@@ -254,10 +198,7 @@
 			if flt(d.credit)>0 and (d.account not in credit_list): credit_list.append(d.account)
 
 		self.doc.total_debit = debit
-		if self.doc.tds_applicable == 'Yes':
-			self.doc.total_credit = credit + flt(self.doc.ded_amount)
-		else:
-			self.doc.total_credit = credit
+		self.doc.total_credit = credit
 
 		if abs(self.doc.total_debit-self.doc.total_credit) > 0.001:
 			msgprint("Debit must be equal to Credit. The difference is %s" % (self.doc.total_debit-self.doc.total_credit))
@@ -338,10 +279,7 @@
 		self.get_against_account()
 		self.validate_cheque_info()
 		self.create_remarks()
-		# tds
-		get_obj('TDS Control').validate_first_entry(self)
-		self.get_tds_category_account()
-
+		
 		self.validate_entries_for_advance()
 		self.set_aging_date()
 		
@@ -378,11 +316,4 @@
 					raise Exception
 	
 	def on_cancel(self):
-		self.check_tds_payment_voucher()
-		get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist, cancel=1)
-
-	def check_tds_payment_voucher(self):
-		tdsp =	sql("select parent from `tabTDS Payment Detail` where voucher_no = %s and docstatus = 1 and parent not like 'old%%'", self.doc.name)
-		if tdsp:
-			msgprint("TDS Payment voucher '%s' has been made against this voucher. Please cancel the payment voucher to proceed." % (tdsp and tdsp[0][0] or ''))
-			raise Exception
\ No newline at end of file
+		get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist, cancel=1)
\ No newline at end of file
diff --git a/accounts/doctype/journal_voucher/journal_voucher.txt b/accounts/doctype/journal_voucher/journal_voucher.txt
index e4b4c92..bfa0bfa 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.txt
+++ b/accounts/doctype/journal_voucher/journal_voucher.txt
@@ -2,12 +2,13 @@
  {
   "owner": "Administrator", 
   "docstatus": 0, 
-  "creation": "2012-10-16 12:29:32", 
+  "creation": "2012-12-03 17:26:38", 
   "modified_by": "Administrator", 
-  "modified": "2012-12-03 17:10:41"
+  "modified": "2012-12-04 18:47:42"
  }, 
  {
   "is_submittable": 1, 
+  "autoname": "naming_series:", 
   "name": "__common__", 
   "default_print_format": "Standard", 
   "search_fields": "voucher_type,posting_date, due_date, cheque_no", 
@@ -490,66 +491,6 @@
   "permlevel": 1
  }, 
  {
-  "oldfieldtype": "Section Break", 
-  "doctype": "DocField", 
-  "options": "Simple", 
-  "fieldname": "section_break0", 
-  "fieldtype": "Section Break", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "allow_on_submit": 1, 
-  "oldfieldtype": "Button", 
-  "doctype": "DocField", 
-  "label": "View Ledger Entry", 
-  "trigger": "Client", 
-  "fieldname": "view_ledger_entry", 
-  "fieldtype": "Button", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 0, 
-  "oldfieldtype": "Section Break", 
-  "doctype": "DocField", 
-  "label": "TDS", 
-  "fieldname": "tds", 
-  "fieldtype": "Section Break", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "permlevel": 0, 
-  "no_copy": 1, 
-  "oldfieldtype": "Select", 
-  "doctype": "DocField", 
-  "label": "TDS Applicable", 
-  "oldfieldname": "tds_applicable", 
-  "default": "No", 
-  "fieldname": "tds_applicable", 
-  "fieldtype": "Select", 
-  "search_index": 1, 
-  "options": "\nYes\nNo", 
-  "in_filter": 1
- }, 
- {
-  "print_hide": 1, 
-  "no_copy": 1, 
-  "oldfieldtype": "Select", 
-  "colour": "White:FFF", 
-  "doctype": "DocField", 
-  "label": "TDS Category", 
-  "oldfieldname": "tds_category", 
-  "permlevel": 0, 
-  "trigger": "Client", 
-  "fieldname": "tds_category", 
-  "fieldtype": "Select", 
-  "search_index": 1, 
-  "hidden": 0, 
-  "options": "link:TDS Category", 
-  "in_filter": 1
- }, 
- {
   "print_hide": 1, 
   "no_copy": 1, 
   "oldfieldtype": "Link", 
@@ -565,55 +506,6 @@
   "options": "Account"
  }, 
  {
-  "no_copy": 0, 
-  "oldfieldtype": "Button", 
-  "colour": "White:FFF", 
-  "doctype": "DocField", 
-  "label": "Get TDS", 
-  "trigger": "Client", 
-  "fieldname": "get_tds", 
-  "fieldtype": "Button", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "description": "Tax Code will be populated based on account head mentioned in TDS Category master", 
-  "no_copy": 1, 
-  "oldfieldtype": "Link", 
-  "colour": "White:FFF", 
-  "doctype": "DocField", 
-  "label": "TDS Account Head", 
-  "oldfieldname": "tax_code", 
-  "permlevel": 0, 
-  "fieldname": "tax_code", 
-  "fieldtype": "Link", 
-  "options": "Account"
- }, 
- {
-  "print_hide": 1, 
-  "no_copy": 1, 
-  "oldfieldtype": "Currency", 
-  "doctype": "DocField", 
-  "label": "Rate", 
-  "oldfieldname": "rate", 
-  "trigger": "Client", 
-  "fieldname": "rate", 
-  "fieldtype": "Currency", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "no_copy": 1, 
-  "oldfieldtype": "Currency", 
-  "doctype": "DocField", 
-  "label": "Amount", 
-  "oldfieldname": "ded_amount", 
-  "trigger": "Client", 
-  "fieldname": "ded_amount", 
-  "fieldtype": "Currency", 
-  "permlevel": 0
- }, 
- {
   "amend": 1, 
   "create": 1, 
   "doctype": "DocPerm", 
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js
index 1a9ef60..db9efc1 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -20,20 +20,11 @@
 wn.require('app/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js');
 wn.require('app/buying/doctype/purchase_common/purchase_common.js');
 
-// On Load
-// --------
 cur_frm.cscript.onload = function(doc,dt,dn) {
 	if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
-	if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});  
-	
-	tds_flds = ['tds','tds_applicable','tds_category','get_tds','tax_code','rate','ded_amount','total_tds_on_voucher','tds_amount_on_advance'];
-	if(wn.control_panel.country == 'India') unhide_field(tds_flds);
-	else hide_field(tds_flds);
+	if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
 }
 
-
-//Onload post render
-//------------------------
 cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
 	var callback = function(doc, dt, dn) {
 		var callback1 = function(doc, dt, dn) {
@@ -46,8 +37,6 @@
 	cur_frm.cscript.dynamic_label(doc, dt, dn, callback);
 }
 
-// Refresh
-// --------
 cur_frm.cscript.refresh = function(doc, dt, dn) {
 	
 	cur_frm.clear_custom_buttons();
@@ -67,7 +56,6 @@
 }
 
 
-//Supplier
 cur_frm.cscript.supplier = function(doc,dt,dn) {
 	var callback = function(r,rt) {
 			var doc = locals[cur_frm.doctype][cur_frm.docname];		
@@ -105,8 +93,6 @@
 	if(doc.supplier) get_server_fields('get_supplier_address', JSON.stringify({supplier: doc.supplier, address: doc.supplier_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
 }
 
-
-
 cur_frm.fields_dict.supplier_address.on_new = function(dn) {
 	locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
 	locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
@@ -135,10 +121,6 @@
 	get_server_fields('get_cust', '', '', doc, dt, dn, 1, callback);
 }
 
-
-
-//Set expense_head and cost center on adding new row
-//----------------------------------------------
 cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
 	
 	cl = getchildren('Purchase Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
@@ -163,22 +145,16 @@
 }
 
 cur_frm.cscript.write_off_amount = function(doc) {
-	doc.total_amount_to_pay = flt(doc.grand_total) - flt(doc.ded_amount) - flt(doc.write_off_amount);
+	doc.total_amount_to_pay = flt(doc.grand_total) - flt(doc.write_off_amount);
 	doc.outstanding_amount = flt(doc.total_amount_to_pay) - flt(doc.total_advance);
 	refresh_many(['outstanding_amount', 'total_amount_to_pay']);
 }
 
-
-
-// Recalculate Button
-// -------------------
 cur_frm.cscript.recalculate = function(doc, cdt, cdn) {
 	cur_frm.cscript.calculate_tax(doc,cdt,cdn);
 	calc_total_advance(doc,cdt,cdn);
 }
 
-// Get Items Button
-// -----------------
 cur_frm.cscript.get_items = function(doc, dt, dn) {
 	var callback = function(r,rt) { 
 		unhide_field(['supplier_address', 'contact_person']);				
@@ -187,10 +163,6 @@
 	$c_obj(make_doclist(dt,dn),'pull_details','',callback);
 }
 
-// ========== Purchase Invoice Items Table ============
-
-// Item Code
-// ----------
 cur_frm.cscript.item_code = function(doc,cdt,cdn){
 	var d = locals[cdt][cdn];
 	if(d.item_code){
@@ -198,49 +170,11 @@
 	}
 }
 
-// Rate in Deduct Taxes (TDS)
-// --------------------------
-cur_frm.cscript.rate = function(doc,dt,dn) {
-	//This is done as Purchase tax detail and PV detail both contain the same fieldname 'rate'
-	if(dt != 'Purchase Taxes and Charges')	 cur_frm.cscript.calc_amount(doc, 2);
-}
-
-// Amount
-// -------
-cur_frm.cscript.ded_amount = function(doc,dt,dn) {calculate_outstanding(doc);}
-
-// Get TDS Button
-// ---------------
-cur_frm.cscript.get_tds = function(doc, dt, dn) {
-	var callback = function(r,rt) {
-		cur_frm.refresh();
-		refresh_field('ded_amount');
-		//cur_frm.cscript.calc_total(locals[dt][dn]);
-	}
-	$c_obj(make_doclist(dt,dn), 'get_tds', '', callback);
-}
-
-// ===================== Advance Allocation ==================
-cur_frm.cscript.allocated_amount = function(doc,cdt,cdn){
-	var d = locals[cdt][cdn];
-	if (d.allocated_amount && d.tds_amount){
-		d.tds_allocated=flt(d.tds_amount*(d.allocated_amount/d.advance_amount))
-		refresh_field('tds_allocated', d.name, 'advance_allocation_details');
-	}
-	tot_tds=0
-	el = getchildren('Purchase Invoice Advance',doc.name,'advance_allocation_details')
-	for(var i in el){
-		tot_tds += el[i].tds_allocated
-	}
-	doc.tds_amount_on_advance = tot_tds
-	refresh_field('tds_amount_on_advance');
-	
+cur_frm.cscript.allocated_amount = function(doc,cdt,cdn) {
 	calc_total_advance(doc, cdt, cdn);
 }
 
 
-// Make Journal Voucher
-// --------------------
 cur_frm.cscript.make_bank_voucher = function() {
 	$c('accounts.get_default_bank_account', { company: cur_frm.doc.company }, function(r, rt) {
 		if(!r.exc) {
@@ -250,9 +184,6 @@
 }
 
 
-/* ***************************** GET QUERY Functions *************************** */
-
-
 cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
 	return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
 }
@@ -261,21 +192,14 @@
 	return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
 }
 
-// Item Code
-// ----------
 cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
 	return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE tabItem.is_purchase_item="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'
 }
 
-// Credit To
-// ----------
 cur_frm.fields_dict['credit_to'].get_query = function(doc) {
 	return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.is_pl_account="No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
 }
 
-
-// Purchase Order
-// ---------------
 cur_frm.fields_dict['purchase_order_main'].get_query = function(doc) {
 	if (doc.supplier){
 		return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.supplier = "'+ doc.supplier +'" AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`,0) < 100 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50'
@@ -284,8 +208,6 @@
 	}
 }
 
-// Purchase Receipt
-// -----------------
 cur_frm.fields_dict['purchase_receipt_main'].get_query = function(doc) {
 	if (doc.supplier){
 		return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.supplier = "'+ doc.supplier +'" AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 100 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50'
@@ -299,10 +221,6 @@
 	return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
 }
 
-
-// ================== Purchase Invoice Items Table ===================
-// Expense Head
-// -------------
 cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) {
 	return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Debit" OR tabAccount.account_type = "Expense Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
 }
@@ -317,9 +235,6 @@
 	refresh_field('entries');
 }
 
-
-// Cost Center
-//-------------
 cur_frm.fields_dict['entries'].grid.get_field("cost_center").get_query = function(doc) {
 	return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.docstatus != 2 ORDER BY	`tabCost Center`.`name` ASC LIMIT 50';
 }
@@ -335,39 +250,21 @@
 	refresh_field('entries');
 }
 
-
-// TDS Account Head
-cur_frm.fields_dict['tax_code'].get_query = function(doc) {
-	return "SELECT `tabTDS Category Account`.account_head FROM `tabTDS Category Account` WHERE `tabTDS Category Account`.parent = '"+doc.tds_category+"' AND `tabTDS Category Account`.company='"+doc.company+"' AND `tabTDS Category Account`.account_head LIKE '%s' ORDER BY `tabTDS Category Account`.account_head DESC LIMIT 50";
-}
-
-cur_frm.cscript.tax_code = function(doc, dt, dn) {
-	get_server_fields('get_tds_rate','','',doc, dt, dn, 0);
-}
-
-/* ***************************** UTILITY FUNCTIONS ************************ */
-// Calculate Advance
-// ------------------
 calc_total_advance = function(doc,cdt,cdn) {
 	var doc = locals[doc.doctype][doc.name];
 	var el = getchildren('Purchase Invoice Advance',doc.name,'advance_allocation_details')
-	var tot_tds=0;
 	var total_advance = 0;
 	for(var i in el) {
 		if (! el[i].allocated_amount == 0) {
 			total_advance += flt(el[i].allocated_amount);
-			tot_tds += flt(el[i].tds_allocated)
 		}
 	}
-	doc.total_amount_to_pay = flt(doc.grand_total) - flt(doc.ded_amount) - flt(doc.write_off_amount);
-	doc.tds_amount_on_advance = flt(tot_tds);
+	doc.total_amount_to_pay = flt(doc.grand_total) - flt(doc.write_off_amount);
 	doc.total_advance = flt(total_advance);
 	doc.outstanding_amount = flt(doc.total_amount_to_pay) - flt(total_advance);
-	refresh_many(['total_advance','outstanding_amount','tds_amount_on_advance', 'total_amount_to_pay']);
+	refresh_many(['total_advance','outstanding_amount', 'total_amount_to_pay']);
 }
 
-// Make JV
-// --------
 cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
 	var jv = LocalDB.create('Journal Voucher');
 	jv = locals['Journal Voucher'][jv];
@@ -392,7 +289,6 @@
 	loaddoc('Journal Voucher', jv.name);
 }
 
-// ***************** Get project name *****************
 cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
 	return 'SELECT `tabProject`.name FROM `tabProject` \
 		WHERE `tabProject`.status not in ("Completed", "Cancelled") \
@@ -409,7 +305,6 @@
 		cur_frm.pformat.print_heading = "Purchase Invoice";
 }
 
-/****************** Get Accounting Entry *****************/
 cur_frm.cscript.view_ledger_entry = function(){
 	wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);
 }
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py
index 28cf516..7d858a9 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -244,8 +244,6 @@
 				raise Exception , "Validation Error"
 			if not self.doc.remarks:
 				self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Against Bill %s dated %s" % (self.doc.bill_no, formatdate(self.doc.bill_date)))
-				if self.doc.ded_amount:
-					self.doc.remarks = (self.doc.remarks or '') + "\n" + ("Grand Total: %s, Tax Deduction Amount: %s" %(self.doc.grand_total, self.doc.ded_amount))
 		else:
 			if not self.doc.remarks:
 				self.doc.remarks = "No Remarks"
@@ -352,42 +350,6 @@
 				msgprint("Purchase Receipt: " + cstr(d.purchase_receipt) + " conversion_rate : " + cstr(data[0]['conversion_rate']) + " does not match with conversion_rate of current document.")
 				raise Exception
 					
-	# Build tds table if applicable
-	#------------------------------
-	def get_tds(self):
-		if cstr(self.doc.is_opening) != 'Yes':
-			if not self.doc.credit_to:
-				msgprint("Please Enter Credit To account first")
-				raise Exception
-			else:
-				tds_applicable = sql("select tds_applicable from tabAccount where name = '%s'" % self.doc.credit_to)
-				if tds_applicable and cstr(tds_applicable[0][0]) == 'Yes':
-					if not self.doc.tds_applicable:
-						msgprint("Please enter whether TDS Applicable or not")
-						raise Exception
-					if self.doc.tds_applicable == 'Yes':
-						if not self.doc.tds_category:
-							msgprint("Please select TDS Category")
-							raise Exception
-						else:
-							get_obj('TDS Control').get_tds_amount(self)
-							self.doc.total_tds_on_voucher = self.doc.ded_amount
-							self.doc.total_amount_to_pay=flt(self.doc.grand_total) - flt(self.doc.ded_amount) - self.doc.write_off_amount
-							self.doc.outstanding_amount = self.doc.total_amount_to_pay - flt(self.doc.total_advance)
-					elif self.doc.tds_applicable == 'No':
-						self.doc.tds_category = ''
-						self.doc.tax_code = ''
-						self.doc.rate = 0
-						self.doc.ded_amount = 0
-						self.doc.total_tds_on_voucher = 0
-
-	# get tds rate
-	# -------------
-	def get_tds_rate(self):
-		return {'rate' : flt(webnotes.conn.get_value('Account', self.doc.tax_code, 'tax_rate'))}
-
-	# set aging date
-	#-------------------
 	def set_aging_date(self):
 		if self.doc.is_opening != 'Yes':
 			self.doc.aging_date = self.doc.posting_date
@@ -452,11 +414,7 @@
 				self.po_list.append(d.purchase_order)
 			if not d.purhcase_receipt in self.pr_list:
 				self.pr_list.append(d.purchase_receipt)
-		# tds
-		get_obj('TDS Control').validate_first_entry(self)
-		if not flt(self.doc.ded_amount):
-			self.get_tds()
-			self.doc.save()
+
 
 		if not self.doc.is_opening:
 			self.doc.is_opening = 'No'
@@ -467,7 +425,8 @@
 		self.set_against_expense_account()
 
 		#FY validation
-		get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
+		get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,
+		 	self.doc.posting_date,'Posting Date')
 		
 		self.validate_write_off_account()
 		
@@ -477,10 +436,9 @@
 		 # get total in words
 		dcc = TransactionBase().get_company_currency(self.doc.company)
 		self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
-		self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
-# ***************************** SUBMIT *****************************
-	# Check Ref Document docstatus
-	# -----------------------------
+		self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency,
+		 	self.doc.grand_total_import)
+
 	def check_prev_docstatus(self):
 		for d in getlist(self.doclist,'entries'):
 			if d.purchase_order:
@@ -495,7 +453,6 @@
 					raise Exception , "Validation Error."
 					
 					
-	#--------------------------------------------------------------------
 	def update_against_document_in_jv(self):
 		"""
 			Links invoice and advance voucher:
@@ -524,9 +481,6 @@
 			get_obj('GL Control').reconcile_against_document(lst)
 
 
-
-	# On Submit
-	#--------------------------------------------------------------------
 	def on_submit(self):
 		self.check_prev_docstatus()
 		
@@ -547,38 +501,18 @@
 			use_mapper = (self.doc.write_off_account and self.doc.write_off_amount and 'Purchase Invoice with write off' or ''))
 
 
-
-
-# ********************************* CANCEL *********************************
-	# Check Next Document's docstatus
-	# --------------------------------
 	def check_next_docstatus(self):
 		submit_jv = sql("select t1.name from `tabJournal Voucher` t1,`tabJournal Voucher Detail` t2 where t1.name = t2.parent and t2.against_voucher = '%s' and t1.docstatus = 1" % (self.doc.name))
 		if submit_jv:
 			msgprint("Journal Voucher : " + cstr(submit_jv[0][0]) + " has been created against " + cstr(self.doc.doctype) + ". So " + cstr(self.doc.doctype) + " cannot be Cancelled.")
 			raise Exception, "Validation Error."
-		
-	# On Cancel
-	# ----------
+	
 	def on_cancel(self):
 		self.check_next_docstatus()
-
-		# Check whether tds payment voucher has been created against this voucher
-		self.check_tds_payment_voucher()
 		
 		self.make_gl_entries(is_cancel=1)
 		get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 0)
 
-
-	# Check whether tds payment voucher has been created against this voucher
-	#---------------------------------------------------------------------------
-	def check_tds_payment_voucher(self):
-		tdsp =	sql("select parent from `tabTDS Payment Detail` where voucher_no = '%s' and docstatus = 1 and parent not like 'old%'")
-		if tdsp:
-			msgprint("TDS Payment voucher '%s' has been made against this voucher. Please cancel the payment voucher to proceed." % (tdsp and tdsp[0][0] or ''))
-			raise Exception
-
-	# on update
 	def on_update(self):
 		pass
 		
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.txt b/accounts/doctype/purchase_invoice/purchase_invoice.txt
index b4c539c..3880689 100755
--- a/accounts/doctype/purchase_invoice/purchase_invoice.txt
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.txt
@@ -2,12 +2,13 @@
  {
   "owner": "Administrator", 
   "docstatus": 0, 
-  "creation": "2012-11-28 11:26:17", 
+  "creation": "2012-12-03 17:26:39", 
   "modified_by": "Administrator", 
-  "modified": "2012-12-03 17:10:41"
+  "modified": "2012-12-04 17:15:28"
  }, 
  {
   "is_submittable": 1, 
+  "autoname": "naming_series:", 
   "allow_attach": 1, 
   "default_print_format": "Standard", 
   "search_fields": "posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount", 
@@ -613,95 +614,6 @@
   "permlevel": 0
  }, 
  {
-  "print_hide": 1, 
-  "oldfieldtype": "Section Break", 
-  "doctype": "DocField", 
-  "label": "TDS", 
-  "fieldname": "tds", 
-  "fieldtype": "Section Break", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "doctype": "DocField", 
-  "width": "50%", 
-  "fieldname": "column_break5", 
-  "fieldtype": "Column Break", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "oldfieldtype": "Select", 
-  "doctype": "DocField", 
-  "label": "TDS Applicable", 
-  "oldfieldname": "tds_applicable", 
-  "options": "\nYes\nNo", 
-  "fieldname": "tds_applicable", 
-  "fieldtype": "Select", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "oldfieldtype": "Select", 
-  "doctype": "DocField", 
-  "label": "TDS Category", 
-  "oldfieldname": "tds_category", 
-  "options": "link:TDS Category", 
-  "fieldname": "tds_category", 
-  "fieldtype": "Select", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "oldfieldtype": "Button", 
-  "colour": "White:FFF", 
-  "doctype": "DocField", 
-  "label": "Get TDS", 
-  "trigger": "Client", 
-  "fieldname": "get_tds", 
-  "fieldtype": "Button", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "doctype": "DocField", 
-  "width": "50%", 
-  "fieldname": "column_break6", 
-  "fieldtype": "Column Break", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "oldfieldtype": "Link", 
-  "doctype": "DocField", 
-  "label": "TDS Account Head", 
-  "oldfieldname": "tax_code", 
-  "options": "Account", 
-  "fieldname": "tax_code", 
-  "fieldtype": "Link", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "oldfieldtype": "Currency", 
-  "doctype": "DocField", 
-  "label": "Rate", 
-  "oldfieldname": "rate", 
-  "fieldname": "rate", 
-  "fieldtype": "Currency", 
-  "permlevel": 0
- }, 
- {
-  "print_hide": 1, 
-  "oldfieldtype": "Currency", 
-  "doctype": "DocField", 
-  "label": "TDS Amount", 
-  "oldfieldname": "ded_amount", 
-  "fieldname": "ded_amount", 
-  "fieldtype": "Currency", 
-  "permlevel": 0
- }, 
- {
   "oldfieldtype": "Section Break", 
   "doctype": "DocField", 
   "label": "Totals", 
@@ -762,29 +674,6 @@
  }, 
  {
   "print_hide": 1, 
-  "no_copy": 1, 
-  "oldfieldtype": "Currency", 
-  "doctype": "DocField", 
-  "label": "Total TDS On Voucher", 
-  "oldfieldname": "total_tds_on_voucher", 
-  "fieldname": "total_tds_on_voucher", 
-  "fieldtype": "Currency", 
-  "permlevel": 1
- }, 
- {
-  "print_hide": 1, 
-  "no_copy": 1, 
-  "oldfieldtype": "Currency", 
-  "colour": "White:FFF", 
-  "doctype": "DocField", 
-  "label": "TDS Amount On Advance", 
-  "oldfieldname": "tds_amount_on_advance", 
-  "fieldname": "tds_amount_on_advance", 
-  "fieldtype": "Currency", 
-  "permlevel": 1
- }, 
- {
-  "print_hide": 1, 
   "oldfieldtype": "Column Break", 
   "doctype": "DocField", 
   "width": "50%", 
@@ -809,7 +698,7 @@
   "no_copy": 1, 
   "oldfieldtype": "Currency", 
   "doctype": "DocField", 
-  "label": "Total Advance (Incl. TDS)", 
+  "label": "Total Advance", 
   "oldfieldname": "total_advance", 
   "fieldname": "total_advance", 
   "fieldtype": "Currency", 
diff --git a/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.txt b/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.txt
index 586ae1c..105124c 100644
--- a/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.txt
+++ b/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.txt
@@ -1,134 +1,82 @@
-# DocType, Purchase Invoice Advance
 [
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:40',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:35:40',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 20
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Purchase Invoice Advance',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# DocType, Purchase Invoice Advance
-	{
-		'doctype': 'DocType',
-		'name': u'Purchase Invoice Advance'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'journal_voucher',
-		'fieldtype': u'Link',
-		'label': u'Journal Voucher',
-		'no_copy': 1,
-		'oldfieldname': u'journal_voucher',
-		'oldfieldtype': u'Link',
-		'options': u'Journal Voucher',
-		'permlevel': 1,
-		'width': u'180px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'jv_detail_no',
-		'fieldtype': u'Date',
-		'hidden': 1,
-		'label': u'Journal Voucher Detail No',
-		'no_copy': 1,
-		'oldfieldname': u'jv_detail_no',
-		'oldfieldtype': u'Date',
-		'permlevel': 1,
-		'print_hide': 1,
-		'width': u'80px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'advance_amount',
-		'fieldtype': u'Currency',
-		'label': u'Advance Amount',
-		'no_copy': 1,
-		'oldfieldname': u'advance_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'allocated_amount',
-		'fieldtype': u'Currency',
-		'label': u'Allocated Amount',
-		'no_copy': 1,
-		'oldfieldname': u'allocated_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 0,
-		'trigger': u'Client',
-		'width': u'100px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tds_amount',
-		'fieldtype': u'Currency',
-		'label': u'TDS Amount',
-		'oldfieldname': u'tds_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'width': u'80px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tds_allocated',
-		'fieldtype': u'Currency',
-		'label': u'TDS Allocated',
-		'oldfieldname': u'tds_allocated',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'width': u'80px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'remarks',
-		'fieldtype': u'Small Text',
-		'label': u'Remarks',
-		'no_copy': 1,
-		'oldfieldname': u'remarks',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1,
-		'width': u'150px'
-	}
+ {
+  "owner": "Administrator", 
+  "docstatus": 0, 
+  "creation": "2012-07-03 13:29:54", 
+  "modified_by": "Administrator", 
+  "modified": "2012-12-04 17:19:38"
+ }, 
+ {
+  "istable": 1, 
+  "name": "__common__", 
+  "doctype": "DocType", 
+  "module": "Accounts"
+ }, 
+ {
+  "name": "__common__", 
+  "parent": "Purchase Invoice Advance", 
+  "no_copy": 1, 
+  "doctype": "DocField", 
+  "parenttype": "DocType", 
+  "parentfield": "fields"
+ }, 
+ {
+  "name": "Purchase Invoice Advance", 
+  "doctype": "DocType"
+ }, 
+ {
+  "oldfieldtype": "Link", 
+  "doctype": "DocField", 
+  "label": "Journal Voucher", 
+  "oldfieldname": "journal_voucher", 
+  "width": "180px", 
+  "options": "Journal Voucher", 
+  "fieldname": "journal_voucher", 
+  "fieldtype": "Link", 
+  "permlevel": 1
+ }, 
+ {
+  "print_hide": 1, 
+  "oldfieldtype": "Date", 
+  "doctype": "DocField", 
+  "label": "Journal Voucher Detail No", 
+  "oldfieldname": "jv_detail_no", 
+  "width": "80px", 
+  "fieldname": "jv_detail_no", 
+  "fieldtype": "Date", 
+  "hidden": 1, 
+  "permlevel": 1
+ }, 
+ {
+  "oldfieldtype": "Currency", 
+  "doctype": "DocField", 
+  "label": "Advance Amount", 
+  "oldfieldname": "advance_amount", 
+  "width": "100px", 
+  "fieldname": "advance_amount", 
+  "fieldtype": "Currency", 
+  "permlevel": 1
+ }, 
+ {
+  "oldfieldtype": "Currency", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Allocated Amount", 
+  "oldfieldname": "allocated_amount", 
+  "width": "100px", 
+  "trigger": "Client", 
+  "fieldname": "allocated_amount", 
+  "fieldtype": "Currency", 
+  "permlevel": 0
+ }, 
+ {
+  "oldfieldtype": "Small Text", 
+  "doctype": "DocField", 
+  "label": "Remarks", 
+  "oldfieldname": "remarks", 
+  "width": "150px", 
+  "fieldname": "remarks", 
+  "fieldtype": "Small Text", 
+  "permlevel": 1
+ }
 ]
\ No newline at end of file
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index 48f9e96..ca3a2ae 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -162,7 +162,7 @@
 
 cur_frm.cscript.warehouse = function(doc, cdt , cdn) {
 	var d = locals[cdt][cdn];
-	if (!d.item_code) {alert("please enter item code first"); return};
+	if (!d.item_code) { msgprint("please enter item code first"); return };
 	if (d.warehouse) {
 		arg = "{'item_code':'" + d.item_code + "','warehouse':'" + d.warehouse +"'}";
 		get_server_fields('get_actual_qty',arg,'entries',doc,cdt,cdn,1);
diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py
index 6b70d64..00a5bfa 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/accounts/doctype/sales_invoice/sales_invoice.py
@@ -902,7 +902,7 @@
 def get_bank_cash_account(mode_of_payment):
 	val = webnotes.conn.get_value("Mode of Payment", mode_of_payment, "default_account")
 	if not val:
-		webnotes.msgprint("Default Account not set in Mode of Payment: ")
+		webnotes.msgprint("Default Account not set in Mode of Payment: %s" % mode_of_payment)
 	return {
 		"cash_bank_account": val
 	}
\ No newline at end of file
diff --git a/accounts/doctype/tds_category/__init__.py b/accounts/doctype/tds_category/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/tds_category/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/tds_category/tds_category.js b/accounts/doctype/tds_category/tds_category.js
deleted file mode 100644
index 3cad944..0000000
--- a/accounts/doctype/tds_category/tds_category.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
- 
-
-//--------- ONLOAD -------------
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
-   
-}
-
-cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-   
-}
\ No newline at end of file
diff --git a/accounts/doctype/tds_category/tds_category.py b/accounts/doctype/tds_category/tds_category.py
deleted file mode 100644
index 3b23c38..0000000
--- a/accounts/doctype/tds_category/tds_category.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
-
-sql = webnotes.conn.sql
-	
-
-
-class DocType:
-  def __init__(self, doc, doclist):
-    self.doc = doc
-    self.doclist = doclist
-    
-  def validate(self):
-    self.doc.module = 'Accounts'
\ No newline at end of file
diff --git a/accounts/doctype/tds_category/tds_category.txt b/accounts/doctype/tds_category/tds_category.txt
deleted file mode 100644
index caac059..0000000
--- a/accounts/doctype/tds_category/tds_category.txt
+++ /dev/null
@@ -1,135 +0,0 @@
-# DocType, TDS Category
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:48',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:35:48',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1302586171',
-		'autoname': u'field:category_name',
-		'colour': u'White:FFF',
-		'doctype': 'DocType',
-		'document_type': u'Master',
-		'in_create': 0,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 8
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'TDS Category',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'TDS Category',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'permlevel': 0,
-		'read': 1
-	},
-
-	# DocType, TDS Category
-	{
-		'doctype': 'DocType',
-		'name': u'TDS Category'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'role': u'Accounts Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': u'DocPerm',
-		'role': u'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'role': u'Accounts User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocField
-	{
-		'default': u'Accounts',
-		'doctype': u'DocField',
-		'fieldname': u'module',
-		'fieldtype': u'Link',
-		'hidden': 0,
-		'in_filter': 0,
-		'label': u'Module',
-		'oldfieldname': u'module',
-		'oldfieldtype': u'Link',
-		'options': u'Module Def',
-		'print_hide': 0,
-		'report_hide': 0,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'note_html',
-		'fieldtype': u'HTML',
-		'label': u'Note HTML',
-		'oldfieldtype': u'HTML',
-		'options': u'<b>Note:</b> You must first create the Accounts from the Chart of Accounts and then link it to this Category.'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'category_name',
-		'fieldtype': u'Data',
-		'label': u'Category Name',
-		'oldfieldname': u'category_name',
-		'oldfieldtype': u'Data',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tds_sh_edu_cess_account',
-		'fieldtype': u'Table',
-		'label': u'TDS Account Detail',
-		'oldfieldname': u'tds_sh_edu_cess_account',
-		'oldfieldtype': u'Table',
-		'options': u'TDS Category Account',
-		'reqd': 0
-	}
-]
\ No newline at end of file
diff --git a/accounts/doctype/tds_category_account/__init__.py b/accounts/doctype/tds_category_account/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/tds_category_account/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/tds_category_account/tds_category_account.py b/accounts/doctype/tds_category_account/tds_category_account.py
deleted file mode 100644
index 7f48feb..0000000
--- a/accounts/doctype/tds_category_account/tds_category_account.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/accounts/doctype/tds_category_account/tds_category_account.txt b/accounts/doctype/tds_category_account/tds_category_account.txt
deleted file mode 100644
index 522ef35..0000000
--- a/accounts/doctype/tds_category_account/tds_category_account.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-# DocType, TDS Category Account
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:48',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:35:48',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 2
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'fieldtype': u'Link',
-		'name': '__common__',
-		'oldfieldtype': u'Link',
-		'parent': u'TDS Category Account',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocType, TDS Category Account
-	{
-		'doctype': 'DocType',
-		'name': u'TDS Category Account'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'company',
-		'in_filter': 1,
-		'label': u'Company',
-		'oldfieldname': u'company',
-		'options': u'Company',
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'account_head',
-		'label': u'Account Head',
-		'oldfieldname': u'account_head',
-		'options': u'Account'
-	}
-]
\ No newline at end of file
diff --git a/accounts/doctype/tds_control/__init__.py b/accounts/doctype/tds_control/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/tds_control/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/tds_control/tds_control.py b/accounts/doctype/tds_control/tds_control.py
deleted file mode 100644
index 1aaa2e5..0000000
--- a/accounts/doctype/tds_control/tds_control.py
+++ /dev/null
@@ -1,123 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-from webnotes.utils import cstr, flt, getdate
-from webnotes.model import db_exists
-from webnotes.model.wrapper import getlist, copy_doclist
-from webnotes import msgprint
-
-sql = webnotes.conn.sql
-	
-
-
-class DocType:
-  def __init__(self, doc, doclist=[]):
-    self.doc = doc
-    self.doclist = doclist
-
-
-  # ============TDS==================
-  # Stop payable voucher on which tds is applicable is made before posting date of the
-  # voucher in which tds was applicable for 1st time
-        
-  def validate_first_entry(self,obj):
-    if obj.doc.doctype == 'Purchase Invoice':
-      supp_acc = obj.doc.credit_to
-    elif obj.doc.doctype == 'Journal Voucher':
-      supp_acc = obj.doc.supplier_account
-
-    if obj.doc.ded_amount:
-      # first pv
-      first_pv = sql("select posting_date from `tabPurchase Invoice` where credit_to = '%s' and docstatus = 1 and tds_category = '%s' and fiscal_year = '%s' and tds_applicable = 'Yes' and (ded_amount != 0 or ded_amount is not null) order by posting_date asc limit 1"%(supp_acc, obj.doc.tds_category, obj.doc.fiscal_year))
-      first_pv_date = first_pv and first_pv[0][0] or ''
-      # first jv
-      first_jv = sql("select posting_date from `tabJournal Voucher` where supplier_account = '%s'and docstatus = 1 and tds_category = '%s' and fiscal_year = '%s' and tds_applicable = 'Yes' and (ded_amount != 0 or ded_amount is not null) order by posting_date asc limit 1"%(supp_acc, obj.doc.tds_category, obj.doc.fiscal_year))
-      first_jv_date = first_jv and first_jv[0][0] or ''
-
-      #first tds voucher date
-      first_tds_date = ''
-      if first_pv_date and first_jv_date:
-        first_tds_date = first_pv_date < first_jv_date and first_pv_date or first_jv_date
-      elif first_pv_date:
-        first_tds_date = first_pv_date
-      elif first_jv_date:
-        first_tds_date = first_jv_date
-
-      if first_tds_date and getdate(obj.doc.posting_date) < first_tds_date:
-        msgprint("First tds voucher for this category has been made already. Hence payable voucher cannot be made before posting date of first tds voucher ")
-        raise Exception
-    
-  # TDS function definition
-  #---------------------------
-  def get_tds_amount(self, obj):    
-    # Validate if posting date b4 first tds entry for this category
-    self.validate_first_entry(obj)
-
-    # get current amount and supplier head
-    if obj.doc.doctype == 'Purchase Invoice':
-      supplier_account = obj.doc.credit_to
-      total_amount=flt(obj.doc.grand_total)
-      for d in getlist(obj.doclist,'advance_allocation_details'):
-        if flt(d.tds_amount)!=0:
-          total_amount -= flt(d.allocated_amount)
-    elif obj.doc.doctype == 'Journal Voucher':      
-      supplier_account = obj.doc.supplier_account
-      total_amount = obj.doc.total_debit
-
-    if obj.doc.tds_category:      
-      # get total billed
-      total_billed = 0
-      pv = sql("select sum(ifnull(grand_total,0)), sum(ifnull(ded_amount,0)) from `tabPurchase Invoice` where tds_category = %s and credit_to = %s and fiscal_year = %s and docstatus = 1 and name != %s and is_opening != 'Yes'", (obj.doc.tds_category, supplier_account, obj.doc.fiscal_year, obj.doc.name))
-      jv = sql("select sum(ifnull(total_debit,0)), sum(ifnull(ded_amount,0)) from `tabJournal Voucher` where tds_category = %s and supplier_account = %s and fiscal_year = %s and docstatus = 1 and name != %s and is_opening != 'Yes'", (obj.doc.tds_category, supplier_account, obj.doc.fiscal_year, obj.doc.name))
-      tds_in_pv = pv and pv[0][1] or 0
-      tds_in_jv = jv and jv[0][1] or 0
-      total_billed += flt(pv and pv[0][0] or 0)+flt(jv and jv[0][0] or 0)+flt(total_amount)
-      
-      # get slab
-      slab = sql("SELECT * FROM `tabTDS Rate Detail` t1, `tabTDS Rate Chart` t2 WHERE t1.category = '%s' AND t1.parent=t2.name and t2.applicable_from <= '%s' ORDER BY t2.applicable_from DESC LIMIT 1" % (obj.doc.tds_category, obj.doc.posting_date), as_dict = 1)
-
-      if slab and flt(slab[0]['slab_from']) <= total_billed:
-
-        if flt(tds_in_pv) <= 0 and flt(tds_in_jv) <= 0:
-          total_amount = total_billed
-        slab = slab[0]
-        # special tds rate
-        special_tds = sql("select special_tds_rate, special_tds_limit, special_tds_rate_applicable from `tabTDS Detail` where parent = '%s' and tds_category = '%s'"% (supplier_account,obj.doc.tds_category))
-
-        # get_pan_number
-        pan_no = sql("select pan_number from `tabAccount` where name = '%s'" % supplier_account)
-        pan_no = pan_no and cstr(pan_no[0][0]) or ''
-        if not pan_no and flt(slab.get('rate_without_pan')):
-          msgprint("As there is no PAN number mentioned in the account head: %s, TDS amount will be calculated at rate %s%%" % (supplier_account, cstr(slab['rate_without_pan'])))
-          tds_rate = flt(slab.get('rate_without_pan'))
-        elif special_tds and special_tds[0][2]=='Yes' and (flt(special_tds[0][1])==0 or flt(special_tds[0][1]) >= flt(total_amount)):
-          tds_rate =  flt(special_tds[0][0])
-        else: 
-          tds_rate=flt(slab['rate'])
-        # calculate tds amount
-        if flt(slab['rate']):
-          ac = sql("SELECT account_head FROM `tabTDS Category Account` where parent=%s and company=%s", (obj.doc.tds_category,obj.doc.company))
-
-          if ac:
-            obj.doc.tax_code = ac[0][0]
-            obj.doc.rate = tds_rate
-            obj.doc.ded_amount = round(flt(tds_rate) * flt(total_amount) / 100)
-          else:
-            msgprint("TDS Account not selected in TDS Category %s" % (obj.doc.tds_category))
-            raise Exception
diff --git a/accounts/doctype/tds_control/tds_control.txt b/accounts/doctype/tds_control/tds_control.txt
deleted file mode 100644
index ca002eb..0000000
--- a/accounts/doctype/tds_control/tds_control.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# DocType, TDS Control
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:48',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:35:48',
-		'modified_by': u'Administrator',
-		'owner': u'wasim@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'doctype': 'DocType',
-		'issingle': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 36
-	},
-
-	# DocType, TDS Control
-	{
-		'doctype': 'DocType',
-		'name': u'TDS Control'
-	}
-]
\ No newline at end of file
diff --git a/accounts/doctype/tds_detail/__init__.py b/accounts/doctype/tds_detail/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/tds_detail/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/tds_detail/tds_detail.py b/accounts/doctype/tds_detail/tds_detail.py
deleted file mode 100644
index 7f48feb..0000000
--- a/accounts/doctype/tds_detail/tds_detail.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/accounts/doctype/tds_detail/tds_detail.txt b/accounts/doctype/tds_detail/tds_detail.txt
deleted file mode 100644
index b15e346..0000000
--- a/accounts/doctype/tds_detail/tds_detail.txt
+++ /dev/null
@@ -1,108 +0,0 @@
-# DocType, TDS Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		u'creation': '2012-07-03 13:29:51',
-		u'docstatus': 0,
-		u'modified': '2012-09-17 11:08:28',
-		u'modified_by': u'Administrator',
-		u'owner': u'wasim@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		u'doctype': u'DocType',
-		'istable': 1,
-		'module': u'Accounts',
-		u'name': u'__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 1
-	},
-
-	# These values are common for all DocField
-	{
-		u'doctype': u'DocField',
-		u'name': u'__common__',
-		'parent': u'TDS Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0,
-		'width': u'150px'
-	},
-
-	# These values are common for all DocPerm
-	{
-		u'doctype': u'DocPerm',
-		u'name': u'__common__',
-		'parent': u'TDS Detail',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1,
-		'role': u'System Manager'
-	},
-
-	# DocType, TDS Detail
-	{
-		u'doctype': u'DocType',
-		u'name': u'TDS Detail'
-	},
-
-	# DocField
-	{
-		u'doctype': u'DocField',
-		'fieldname': u'tds_category',
-		'fieldtype': u'Select',
-		'label': u'TDS Category',
-		'oldfieldname': u'tds_category',
-		'oldfieldtype': u'Select',
-		'options': u'link:TDS Category'
-	},
-
-	# DocField
-	{
-		u'doctype': u'DocField',
-		'fieldname': u'special_tds_rate_applicable',
-		'fieldtype': u'Select',
-		'label': u'Special TDS Rate Applicable',
-		'oldfieldname': u'special_tds_rate_applicable',
-		'oldfieldtype': u'Select',
-		'options': u'\nYes\nNo'
-	},
-
-	# DocField
-	{
-		u'doctype': u'DocField',
-		'fieldname': u'special_tds_rate',
-		'fieldtype': u'Currency',
-		'label': u'Special TDS Rate(Section-197)\t',
-		'oldfieldname': u'special_tds_rate',
-		'oldfieldtype': u'Currency'
-	},
-
-	# DocField
-	{
-		u'doctype': u'DocField',
-		'fieldname': u'special_tds_limit',
-		'fieldtype': u'Currency',
-		'label': u'Special TDS Limit',
-		'oldfieldname': u'special_tds_limit',
-		'oldfieldtype': u'Currency'
-	},
-
-	# DocPerm
-	{
-		u'doctype': u'DocPerm',
-		'permlevel': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		u'doctype': u'DocPerm',
-		'permlevel': 1
-	}
-]
\ No newline at end of file
diff --git a/accounts/doctype/tds_payment/__init__.py b/accounts/doctype/tds_payment/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/tds_payment/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/tds_payment/tds_payment.js b/accounts/doctype/tds_payment/tds_payment.js
deleted file mode 100644
index 4b7cb36..0000000
--- a/accounts/doctype/tds_payment/tds_payment.js
+++ /dev/null
@@ -1,91 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.	If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.cscript.onload = function(doc,cdt,cdn){
-	cur_frm.cscript.refresh(doc, cdt, cdn);
-}
-
-
-// get pan and tan no
-cur_frm.cscript.company = function(doc,cdt,cdn){
-	if(doc.company) get_server_fields('get_registration_details','','',doc,cdt,cdn);
-}
-
-// check
-cur_frm.cscript.to_date = function(doc,cdt,cdn){
-	if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
-		alert("From date can not be greater than To date");
-		doc.to_date='';
-		refresh_field('to_date');
-	}
-}
-
-cur_frm.cscript.from_date = function(doc,cdt,cdn){
-	if(doc.from_date && doc.to_date && (doc.from_date>doc.to_date)){
-		alert("From date can not be greater than To date");
-		doc.from_date='';
-		refresh_field('from_date');
-	}
-}
-
-// Make Journal Voucher
-// --------------------
-
-cur_frm.cscript.make_bank_voucher = function(doc, dt, dn) {	
-	var call_back = function(r,rt) {
-		cur_frm.cscript.make_jv(doc,dt,dn,r.message);
-	}
-	// get def bank and tds account
-	$c_obj(make_doclist(dt, dn), 'get_bank_and_tds_account', '', call_back);
-}
-
-cur_frm.cscript.make_jv = function(doc, dt, dn, det) {
-	var jv = LocalDB.create('Journal Voucher');
-	jv = locals['Journal Voucher'][jv];
-	jv.voucher_type = 'Bank Voucher';
-	jv.voucher_date = dateutil.obj_to_str(new Date());
-	jv.posting_date = dateutil.obj_to_str(new Date());
-	jv.aging_date = dateutil.obj_to_str(new Date());
-	jv.remark = repl('Payment against voucher %(vn)s. %(rem)s', {vn:doc.name, rem:doc.remarks});
-	jv.total_debit = doc.total_tds;
-	jv.total_credit = doc.total_tds;
-	jv.fiscal_year = sys_defaults.fiscal_year;
-	jv.company = doc.company;
-
-	// debit to tds account	
-	var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
-	d1.account = det.tds_account;
-	d1.debit = doc.total_tds;
-
-	// credit to bank account
-	var d2 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
-	d2.account = det.bank_account;
-	d2.credit = doc.total_tds;
-	
-	loaddoc('Journal Voucher', jv.name);
-}
-
-// Show / Hide button
-cur_frm.cscript.refresh = function(doc, dt, dn) {
-	if(doc.docstatus==1) { 
-		unhide_field('make_bank_voucher'); 
-		unhide_field('update');
-	}
-	else {
-		hide_field('make_bank_voucher');
-		hide_field('update');
-	} 
-}
diff --git a/accounts/doctype/tds_payment/tds_payment.py b/accounts/doctype/tds_payment/tds_payment.py
deleted file mode 100644
index a3b0080..0000000
--- a/accounts/doctype/tds_payment/tds_payment.py
+++ /dev/null
@@ -1,119 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-from webnotes.utils import cstr, flt, now
-from webnotes.model import db_exists
-from webnotes.model.doc import addchild, make_autoname
-from webnotes.model.wrapper import getlist, copy_doclist
-from webnotes import msgprint
-
-sql = webnotes.conn.sql
-	
-
-
-class DocType:
-  def __init__(self,d,dl):
-    self.doc, self.doclist = d, dl
-
-  def autoname(self):
-    self.doc.name = make_autoname(self.doc.naming_series+'.####')
-
-  # Get pan and tan no from company
-  #---------------------------------
-  def get_registration_details(self):
-    comp_det=sql("Select registration_details from `tabCompany` where name = '%s'"%(self.doc.company))
-    if not comp_det:
-      msgprint("Registration Details is not mentioned in comapny")
-      ret = {'registration_details':  ''}
-    else:
-      ret = { 'registration_details': cstr(comp_det[0][0])}
-   
-    return ret
-
-  # Get default bank and tds account
-  #------------------------------------
-  def get_bank_and_tds_account(self):
-    tds_account=sql("Select account_head from `tabTDS Category Account` where parent='%s' and company='%s'"%(self.doc.tds_category,self.doc.company))
-    tds_account = tds_account and tds_account[0][0] or ''
-
-    def_bank = sql("select default_bank_account from tabCompany where name = '%s'" % self.doc.company)
-    def_bank = def_bank and def_bank[0][0] or ''
-
-    ret = {'tds_account':tds_account, 'bank_account': def_bank}
-    return ret
-
-  # Fetch voucherwise tds details
-  #-------------------------------
-  def get_tds_list(self):
-    self.doclist = self.doc.clear_table(self.doclist,'tds_payment_details')
-    self.doc.total_tds = 0
-    import datetime
-    if not self.doc.tds_category:
-      msgprint("Please select tds category")
-    else:
-      if not self.doc.from_date or not self.doc.to_date:
-        msgprint("Please enter from date and to date")
-      else:
-        idx = 1
-        pv_det= sql("Select name,credit_to,grand_total,posting_date, ded_amount from `tabPurchase Invoice` where tds_category='%s' And posting_date>= '%s' And posting_date <='%s'  and docstatus=1 and ded_amount > 0 Order By posting_date"%(self.doc.tds_category,self.doc.from_date,self.doc.to_date))
-        if pv_det:
-          idx = self.make_tds_table(pv_det, idx)
-        
-        jv_det= sql("Select name, supplier_account, total_debit,posting_date, ded_amount from `tabJournal Voucher` where tds_category='%s' And posting_date<= '%s' And posting_date >='%s' And docstatus=1 and ded_amount > 0 Order By posting_date"%(self.doc.tds_category,self.doc.to_date,self.doc.from_date))
-        if jv_det:
-          self.make_tds_table(jv_det, idx)
-
-  # Create TDS table
-  #------------------
-  def make_tds_table(self,det, idx):
-    for v in det:
-      if not sql("select name from `tabTDS Payment Detail` where voucher_no = '%s' and parent != '%s' and docstatus = 1" % (v[0], self.doc.name)):
-        child = addchild(self.doc, 'tds_payment_details', 'TDS Payment Detail', 1, self.doclist)
-        child.voucher_no = v and v[0] or ''
-        child.party_name = v and v[1] or ''
-        child.amount_paid = v and flt(v[2]) or ''
-        child.date_of_payment =v and v[3].strftime('%Y-%m-%d') or ''
-        child.tds_amount = v and flt(v[4]) or 0
-        child.cess_on_tds = 0
-        child.total_tax_amount = child.tds_amount + child.cess_on_tds
-        child.idx=idx
-        idx=idx+1
-        self.doc.total_tds= flt(self.doc.total_tds)+flt(child.total_tax_amount)
-    return idx
-
-
-  # Update acknowledgement details
-  #---------------------------------------
-  def update_ack_details(self):
-    sql("update `tabTDS Payment` set cheque_no = '%s', bsr_code = '%s', date_of_receipt = '%s', challan_id = '%s' where name = '%s'" % (self.doc.cheque_no, self.doc.bsr_code, self.doc.date_of_receipt, self.doc.challan_id, self.doc.name))
-
-  # Validate
-  #------------------
-  def validate(self):
-    if self.doc.amended_from and not self.doc.amendment_date:
-      msgprint("Please Enter Amendment Date")
-      raise Exception
-
-    self.calculate_total_tds()
-
-  def calculate_total_tds(self):
-    total = 0
-    for d in getlist(self.doclist,'tds_payment_details'):
-      total = flt(total)+flt(d.total_tax_amount)
-    self.doc.total_tds = total
diff --git a/accounts/doctype/tds_payment/tds_payment.txt b/accounts/doctype/tds_payment/tds_payment.txt
deleted file mode 100644
index 506795e..0000000
--- a/accounts/doctype/tds_payment/tds_payment.txt
+++ /dev/null
@@ -1,434 +0,0 @@
-# DocType, TDS Payment
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:48',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:45:52',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'in_create': 0,
-		'is_submittable': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 224
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'TDS Payment',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'TDS Payment',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1
-	},
-
-	# DocType, TDS Payment
-	{
-		'doctype': 'DocType',
-		'name': u'TDS Payment'
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'System Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'All'
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'column_break0',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'from_date',
-		'fieldtype': u'Date',
-		'in_filter': 1,
-		'label': u'From Date',
-		'oldfieldname': u'from_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'to_date',
-		'fieldtype': u'Date',
-		'in_filter': 1,
-		'label': u'To Date',
-		'oldfieldname': u'to_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'tds_category',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'TDS Category',
-		'oldfieldname': u'tds_category',
-		'oldfieldtype': u'Link',
-		'options': u'TDS Category',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'column_break1',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'description': u'To manage multiple series please go to Setup > Series Setup',
-		'doctype': u'DocField',
-		'fieldname': u'naming_series',
-		'fieldtype': u'Select',
-		'label': u'Naming Series',
-		'no_copy': 1,
-		'oldfieldname': u'naming_series',
-		'oldfieldtype': u'Select',
-		'options': u'TDSP',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'fiscal_year',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Fiscal Year',
-		'oldfieldname': u'fiscal_year',
-		'oldfieldtype': u'Select',
-		'options': u'link:Fiscal Year',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amended_from',
-		'fieldtype': u'Data',
-		'label': u'Amended From',
-		'no_copy': 1,
-		'oldfieldname': u'amended_from',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'description': u'The date at which current entry is corrected in the system.',
-		'doctype': u'DocField',
-		'fieldname': u'amendment_date',
-		'fieldtype': u'Date',
-		'label': u'Amendment Date',
-		'no_copy': 1,
-		'oldfieldname': u'amendment_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'section_break0',
-		'fieldtype': u'Section Break',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'column_break2',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'company',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'Company',
-		'oldfieldname': u'company',
-		'oldfieldtype': u'Link',
-		'options': u'Company',
-		'permlevel': 0,
-		'search_index': 0,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'registration_details',
-		'fieldtype': u'Small Text',
-		'label': u'Registration Details',
-		'oldfieldname': u'registration_details',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'remarks',
-		'fieldtype': u'Small Text',
-		'label': u'Remark',
-		'no_copy': 1,
-		'oldfieldname': u'remarks',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'column_break3',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'html0',
-		'fieldtype': u'HTML',
-		'oldfieldtype': u'HTML',
-		'options': u'<b>Please Update Cheque No., BSR Code, Challan ID no. after actual payment. Unless you do not get it in Form 16A.</b>',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'cheque_no',
-		'fieldtype': u'Data',
-		'label': u'Cheque / DD No.',
-		'oldfieldname': u'cheque_no',
-		'oldfieldtype': u'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'bsr_code',
-		'fieldtype': u'Data',
-		'label': u'BSR Code',
-		'oldfieldname': u'bsr_code',
-		'oldfieldtype': u'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'date_of_receipt',
-		'fieldtype': u'Date',
-		'label': u'Date of Receipt',
-		'oldfieldname': u'date_of_receipt',
-		'oldfieldtype': u'Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'challan_id',
-		'fieldtype': u'Data',
-		'label': u'Challan ID',
-		'oldfieldname': u'challan_id',
-		'oldfieldtype': u'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'update',
-		'fieldtype': u'Button',
-		'label': u'Update',
-		'oldfieldtype': u'Button',
-		'options': u'update_ack_details',
-		'permlevel': 0,
-		'report_hide': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'section_break1',
-		'fieldtype': u'Section Break',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'get_tds_list',
-		'fieldtype': u'Button',
-		'label': u'Get TDS List',
-		'oldfieldtype': u'Button',
-		'options': u'get_tds_list',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tds_payment_details',
-		'fieldtype': u'Table',
-		'label': u'TDS Payment Details',
-		'oldfieldname': u'tds_payment_details',
-		'oldfieldtype': u'Table',
-		'options': u'TDS Payment Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'section_break2',
-		'fieldtype': u'Section Break',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'total_tds',
-		'fieldtype': u'Currency',
-		'label': u'Total TDS',
-		'oldfieldname': u'total_tds',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'make_bank_voucher',
-		'fieldtype': u'Button',
-		'label': u'Make Bank Voucher',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'trigger': u'Client'
-	}
-]
\ No newline at end of file
diff --git a/accounts/doctype/tds_payment_detail/__init__.py b/accounts/doctype/tds_payment_detail/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/tds_payment_detail/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/tds_payment_detail/tds_payment_detail.py b/accounts/doctype/tds_payment_detail/tds_payment_detail.py
deleted file mode 100644
index 7f48feb..0000000
--- a/accounts/doctype/tds_payment_detail/tds_payment_detail.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/accounts/doctype/tds_payment_detail/tds_payment_detail.txt b/accounts/doctype/tds_payment_detail/tds_payment_detail.txt
deleted file mode 100644
index 4443090..0000000
--- a/accounts/doctype/tds_payment_detail/tds_payment_detail.txt
+++ /dev/null
@@ -1,111 +0,0 @@
-# DocType, TDS Payment Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:49',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:35:49',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 11
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'TDS Payment Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, TDS Payment Detail
-	{
-		'doctype': 'DocType',
-		'name': u'TDS Payment Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'voucher_no',
-		'fieldtype': u'Data',
-		'label': u'Voucher No',
-		'oldfieldname': u'voucher_no',
-		'oldfieldtype': u'Data'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'party_name',
-		'fieldtype': u'Data',
-		'label': u'Party Name',
-		'oldfieldname': u'party_name',
-		'oldfieldtype': u'Data'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'amount_paid',
-		'fieldtype': u'Currency',
-		'label': u'Amount paid / credited',
-		'oldfieldname': u'amount_paid',
-		'oldfieldtype': u'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'date_of_payment',
-		'fieldtype': u'Date',
-		'label': u'Date of payment / credit',
-		'oldfieldname': u'date_of_payment',
-		'oldfieldtype': u'Date'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tds_amount',
-		'fieldtype': u'Currency',
-		'label': u'TDS',
-		'oldfieldname': u'tds_amount',
-		'oldfieldtype': u'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'cess_on_tds',
-		'fieldtype': u'Currency',
-		'label': u'Cess on TDS',
-		'oldfieldname': u'cess_on_tds',
-		'oldfieldtype': u'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'total_tax_amount',
-		'fieldtype': u'Currency',
-		'label': u'Total Tax Amount',
-		'oldfieldname': u'total_tax_amount',
-		'oldfieldtype': u'Currency'
-	}
-]
\ No newline at end of file
diff --git a/accounts/doctype/tds_rate_chart/__init__.py b/accounts/doctype/tds_rate_chart/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/tds_rate_chart/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/tds_rate_chart/tds_rate_chart.py b/accounts/doctype/tds_rate_chart/tds_rate_chart.py
deleted file mode 100644
index 7f48feb..0000000
--- a/accounts/doctype/tds_rate_chart/tds_rate_chart.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/accounts/doctype/tds_rate_chart/tds_rate_chart.txt b/accounts/doctype/tds_rate_chart/tds_rate_chart.txt
deleted file mode 100644
index 52d475d..0000000
--- a/accounts/doctype/tds_rate_chart/tds_rate_chart.txt
+++ /dev/null
@@ -1,121 +0,0 @@
-# DocType, TDS Rate Chart
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:49',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:35:49',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'Prompt',
-		'colour': u'White:FFF',
-		'doctype': 'DocType',
-		'in_create': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'read_only': 0,
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 11
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'TDS Rate Chart',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'TDS Rate Chart',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'permlevel': 0,
-		'read': 1
-	},
-
-	# DocType, TDS Rate Chart
-	{
-		'doctype': 'DocType',
-		'name': u'TDS Rate Chart'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'role': u'Accounts Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'create': 1,
-		'doctype': u'DocPerm',
-		'role': u'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'role': u'Accounts User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocField
-	{
-		'default': u'Accounts',
-		'doctype': u'DocField',
-		'fieldname': u'module',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'label': u'Module',
-		'oldfieldname': u'module',
-		'oldfieldtype': u'Link',
-		'options': u'Module Def',
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'applicable_from',
-		'fieldtype': u'Date',
-		'label': u'Applicable From',
-		'oldfieldname': u'applicable_from',
-		'oldfieldtype': u'Date',
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'rate_chart_detail',
-		'fieldtype': u'Table',
-		'label': u'Rate Chart Detail',
-		'oldfieldname': u'rate_chart_detail',
-		'oldfieldtype': u'Table',
-		'options': u'TDS Rate Detail'
-	}
-]
\ No newline at end of file
diff --git a/accounts/doctype/tds_rate_detail/__init__.py b/accounts/doctype/tds_rate_detail/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/tds_rate_detail/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/tds_rate_detail/tds_rate_detail.py b/accounts/doctype/tds_rate_detail/tds_rate_detail.py
deleted file mode 100644
index 7f48feb..0000000
--- a/accounts/doctype/tds_rate_detail/tds_rate_detail.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/accounts/doctype/tds_rate_detail/tds_rate_detail.txt b/accounts/doctype/tds_rate_detail/tds_rate_detail.txt
deleted file mode 100644
index d343286..0000000
--- a/accounts/doctype/tds_rate_detail/tds_rate_detail.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-# DocType, TDS Rate Detail
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:49',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:35:49',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Tray',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 7
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'TDS Rate Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, TDS Rate Detail
-	{
-		'doctype': 'DocType',
-		'name': u'TDS Rate Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'category',
-		'fieldtype': u'Link',
-		'label': u'Category',
-		'oldfieldname': u'category',
-		'oldfieldtype': u'Link',
-		'options': u'TDS Category',
-		'width': u'200px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'slab_from',
-		'fieldtype': u'Currency',
-		'label': u'Slab From',
-		'oldfieldname': u'slab_from',
-		'oldfieldtype': u'Currency'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'rate',
-		'fieldtype': u'Currency',
-		'label': u'Rate',
-		'oldfieldname': u'rate',
-		'oldfieldtype': u'Currency',
-		'width': u'50px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'rate_without_pan',
-		'fieldtype': u'Currency',
-		'label': u'Rate without PAN',
-		'oldfieldname': u'rate_without_pan',
-		'oldfieldtype': u'Currency'
-	}
-]
\ No newline at end of file
diff --git a/accounts/doctype/tds_return_acknowledgement/__init__.py b/accounts/doctype/tds_return_acknowledgement/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/doctype/tds_return_acknowledgement/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.js b/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.js
deleted file mode 100644
index a0cede6..0000000
--- a/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-cur_frm.fields_dict['quarter'].get_query = function(doc, cdt, cdn) {
-  if(doc.fiscal_year)
-    return 'SELECT `tabPeriod`.name FROM `tabPeriod` WHERE `tabPeriod`.fiscal_year = "'+doc.fiscal_year+'" AND `tabPeriod`.period_type = "Quarter" AND `tabPeriod`.docstatus != 2 AND `tabPeriod`.name LIKE "%s" ORDER BY `tabPeriod`.start_date ASC LIMIT 50';
-}
diff --git a/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.py b/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.py
deleted file mode 100644
index 7f48feb..0000000
--- a/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-import webnotes
-
-class DocType:
-	def __init__(self, d, dl):
-		self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.txt b/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.txt
deleted file mode 100644
index 4471ad59..0000000
--- a/accounts/doctype/tds_return_acknowledgement/tds_return_acknowledgement.txt
+++ /dev/null
@@ -1,121 +0,0 @@
-# DocType, TDS Return Acknowledgement
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:49',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:35:49',
-		'modified_by': u'Administrator',
-		'owner': u'nabin@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': u'TDSR/.####',
-		'colour': u'White:FFF',
-		'doctype': 'DocType',
-		'module': u'Accounts',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'version': 13
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'TDS Return Acknowledgement',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# These values are common for all DocPerm
-	{
-		'create': 1,
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'TDS Return Acknowledgement',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'write': 1
-	},
-
-	# DocType, TDS Return Acknowledgement
-	{
-		'doctype': 'DocType',
-		'name': u'TDS Return Acknowledgement'
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'role': u'Accounts User'
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'role': u'Accounts Manager'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'fiscal_year',
-		'fieldtype': u'Select',
-		'label': u'Fiscal Year',
-		'oldfieldname': u'fiscal_year',
-		'oldfieldtype': u'Select',
-		'options': u'link:Fiscal Year'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'doctype': u'DocField',
-		'fieldname': u'quarter',
-		'fieldtype': u'Select',
-		'label': u'Quarter',
-		'oldfieldname': u'quarter',
-		'oldfieldtype': u'Select',
-		'options': u'\nApr-Jun\nJul-Sept\nOct-Dec\nJan-Mar',
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'tds_category',
-		'fieldtype': u'Select',
-		'label': u'TDS Category',
-		'oldfieldname': u'tds_category',
-		'oldfieldtype': u'Select',
-		'options': u'link:TDS Category'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'acknowledgement_no',
-		'fieldtype': u'Data',
-		'label': u'Acknowledgement No',
-		'oldfieldname': u'acknowledgement_no',
-		'oldfieldtype': u'Data'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'date_of_receipt',
-		'fieldtype': u'Date',
-		'label': u'Date of Receipt',
-		'oldfieldname': u'date_of_receipt',
-		'oldfieldtype': u'Date'
-	}
-]
\ No newline at end of file
diff --git a/accounts/page/accounts_browser/accounts_browser.py b/accounts/page/accounts_browser/accounts_browser.py
index 76c64b7..8b24394 100644
--- a/accounts/page/accounts_browser/accounts_browser.py
+++ b/accounts/page/accounts_browser/accounts_browser.py
@@ -20,7 +20,7 @@
 	else:
 		return [r[0] for r in webnotes.conn.sql("""select name from tabCompany
 			where docstatus!=2""")]
-	
+
 @webnotes.whitelist()
 def get_children():
 	args = webnotes.form_dict
diff --git a/accounts/search_criteria/tds_return/__init__.py b/accounts/search_criteria/tds_return/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/tds_return/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/tds_return/tds_return.js b/accounts/search_criteria/tds_return/tds_return.js
deleted file mode 100644
index 17cc2b3..0000000
--- a/accounts/search_criteria/tds_return/tds_return.js
+++ /dev/null
@@ -1,37 +0,0 @@
-// ERPNext - web based ERP (http://erpnext.com)
-// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-// 
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-report.customize_filters = function() {
-  this.hide_all_filters();
-
-  this.filter_fields_dict['TDS Payment'+FILTER_SEP +'Company'].df.filter_hide = 0;
-  this.filter_fields_dict['TDS Payment'+FILTER_SEP +'TDS Category'].df.filter_hide = 0;
-
-  this.add_filter({fieldname:'transaction_date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'TDS Payment'});  
-
-  this.filter_fields_dict['TDS Payment'+FILTER_SEP +'From Date'].df['report_default']=sys_defaults.year_start_date;
-  this.filter_fields_dict['TDS Payment'+FILTER_SEP +'To Date'].df['report_default']=dateutil.obj_to_str(new Date());
-  this.filter_fields_dict['TDS Payment'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
-
-  this.filter_fields_dict['TDS Payment'+FILTER_SEP +'From Date'].df.in_first_page = 1;
-  this.filter_fields_dict['TDS Payment'+FILTER_SEP +'To Date'].df.in_first_page = 1;
-  this.filter_fields_dict['TDS Payment'+FILTER_SEP +'Company'].df.in_first_page = 1;
-  this.filter_fields_dict['TDS Payment'+FILTER_SEP +'TDS Category'].df.in_first_page = 1;
-
-}
-
-this.mytabs.items['Select Columns'].hide();
-this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/accounts/search_criteria/tds_return/tds_return.py b/accounts/search_criteria/tds_return/tds_return.py
deleted file mode 100644
index 41693b6..0000000
--- a/accounts/search_criteria/tds_return/tds_return.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-if not filter_values.get('tds_category'):
-  msgprint("Please enter TDS Category")
-  raise Exception
-
-l = [
-      ['ID','150px','Link','TDS Payment'],
-      ['Challan ID No.','100px','Data',''], 
-      ['Party Name','200px','Link','Account'], 
-      ['Amount paid / credited','100px','Currency',''], 
-      ['Date of payment / credit','100px','Date',''], 
-      ['TDS','100px','Currency',''], 
-      ['Cess on TDS','100px','Currency',''], 
-      ['Total Tax Amount','100px','Currency',''], 
-      ['PAN of the deductee','100px','Data',''],
-      ['Total Tax Deposited','100px','Currency',''],
-      ['Date of Deduction','100px','Date',''], 
-      ['Rate at which deducted','100px','Currency',''], 
-      ['Reason for Non-deduction / Lower deduction','100px','Data',''], 
-      ['Grossing up indicator','100px','Data',''], 
-      ['Deductee Code','100px','Data',''], 
-      ['Mode','100px','Data','']
-    ]
-
-for i in l:
-  colnames.append(i[0])
-  colwidths.append(i[1])
-  coltypes.append(i[2])
-  coloptions.append(i[3])
-  col_idx[i[0]] = len(colnames)-1
-
-for r in res:
-  r.append(r[col_idx['Total Tax Amount']])
-  for i in range(0,6):
-    r.append('')
\ No newline at end of file
diff --git a/accounts/search_criteria/tds_return/tds_return.sql b/accounts/search_criteria/tds_return/tds_return.sql
deleted file mode 100644
index 17eb970..0000000
--- a/accounts/search_criteria/tds_return/tds_return.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-SELECT `tabTDS Payment`.`name`,`tabTDS Payment`.`challan_no`,`tabTDS Payment Detail`.`party_name`,`tabTDS Payment Detail`.`amount_paid`,`tabTDS Payment Detail`.`date_of_payment`,`tabTDS Payment Detail`.`tds_amount`,`tabTDS Payment Detail`.`cess_on_tds`,`tabTDS Payment Detail`.`total_tax_amount`,(`tabAccount`.pan_number) AS 'PAN of the deductee'
-  FROM `tabTDS Payment Detail`,`tabTDS Payment`,`tabAccount`
-  WHERE `tabTDS Payment`.docstatus = 1
-   AND `tabTDS Payment`.`company` LIKE '%(company)s%%'
-   AND `tabTDS Payment`.`tds_category` LIKE '%(tds_category)s%%'
-   AND `tabTDS Payment`.`from_date`>='%(transaction_date)s'
-   AND `tabTDS Payment`.`to_date`<='%(transaction_date1)s'
-   AND `tabAccount`.name = `tabTDS Payment Detail`.party_name
-   AND `tabTDS Payment Detail`.`parent` = `tabTDS Payment`.`name`
- ORDER BY `PAN of the deductee` DESC
\ No newline at end of file
diff --git a/accounts/search_criteria/tds_return/tds_return.txt b/accounts/search_criteria/tds_return/tds_return.txt
deleted file mode 100644
index 743488d..0000000
--- a/accounts/search_criteria/tds_return/tds_return.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Search Criteria, tds_return
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-04-03 12:49:53',
-		'docstatus': 0,
-		'modified': '2012-04-03 12:49:53',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all Search Criteria
-	{
-		'criteria_name': u'TDS Return',
-		'dis_filters': u'fiscal_year',
-		'doc_type': u'TDS Payment Detail',
-		'doctype': 'Search Criteria',
-		'filters': u"{'TDS Payment\x01Submitted':1}",
-		'module': u'Accounts',
-		'name': '__common__',
-		'parent_doc_type': u'TDS Payment',
-		'standard': u'Yes'
-	},
-
-	# Search Criteria, tds_return
-	{
-		'doctype': 'Search Criteria',
-		'name': u'tds_return'
-	}
-]
\ No newline at end of file
diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js
index 77cfd1b..a815cba 100644
--- a/buying/doctype/purchase_common/purchase_common.js
+++ b/buying/doctype/purchase_common/purchase_common.js
@@ -95,12 +95,9 @@
 	cur_frm.fields_dict['conversion_rate'].label_area.innerHTML = "Conversion Rate (" + doc.currency +' -> '+ base_curr + ')';
 
 	if (doc.doctype == 'Purchase Invoice') {
-		cur_frm.fields_dict['total_tds_on_voucher'].label_area.innerHTML = 'Total TDS On Voucher (' + base_curr + ')';
 		cur_frm.fields_dict['outstanding_amount'].label_area.innerHTML = 'Outstanding Amount (' + base_curr + ')';
-		cur_frm.fields_dict['tds_amount_on_advance'].label_area.innerHTML = 'TDS Amount On Advance (' + base_curr + ')';
 		cur_frm.fields_dict['total_advance'].label_area.innerHTML = 'Total Advance (Incl. TDS) (' + base_curr + ')';
 		cur_frm.fields_dict['total_amount_to_pay'].label_area.innerHTML = 'Total Amount To Pay (' + base_curr + ')';
-		cur_frm.fields_dict['ded_amount'].label_area.innerHTML = 'TDS Amount (' + base_curr + ')';
 	} else cur_frm.fields_dict['rounded_total'].label_area.innerHTML = 'Rounded Total (' + base_curr + ')';
 
 }
@@ -122,7 +119,7 @@
 		$('[data-grid-fieldname="'+cur_frm.cscript.tname+'-rate"]').html('Rate ('+base_curr+')');
 		cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp('rate', hide);
 		// advance table flds
-		adv_cols = {'advance_amount': 'Advance Amount', 'allocated_amount': 'Allocated Amount', 'tds_amount': 'TDS Amount', 'tds_allocated': 'TDS Allocated'}
+		adv_cols = {'advance_amount': 'Advance Amount', 'allocated_amount': 'Allocated Amount'}
 		for (d in adv_cols) $('[data-grid-fieldname="Purchase Invoice Advance-'+d+'"]').html(adv_cols[d]+' ('+base_curr+')');	
 	}
 	else {
@@ -656,16 +653,13 @@
 }
 
 var calculate_outstanding = function(doc) {
-	var t_tds_tax = 0.0;	
-	doc.total_tds_on_voucher = flt(doc.ded_amount);
-
 	// total amount to pay	
-	doc.total_amount_to_pay = flt(flt(doc.net_total) + flt(doc.other_charges_added) - flt(doc.other_charges_deducted) - flt(doc.total_tds_on_voucher));
+	doc.total_amount_to_pay = flt(flt(doc.net_total) + flt(doc.other_charges_added) - flt(doc.other_charges_deducted));
 	
 	// outstanding amount 
-	if(doc.docstatus==0) doc.outstanding_amount = flt(doc.net_total) + flt(doc.other_charges_added) - flt(doc.other_charges_deducted) - flt(doc.total_tds_on_voucher) - flt(doc.total_advance);
+	if(doc.docstatus==0) doc.outstanding_amount = flt(doc.net_total) + flt(doc.other_charges_added) - flt(doc.other_charges_deducted) - flt(doc.total_advance);
 	
-	refresh_many(['total_tds_on_voucher','total_amount_to_pay', 'outstanding_amount']);
+	refresh_many(['total_amount_to_pay', 'outstanding_amount']);
 }
 
 
diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js
index 4d5f2bf..d3bde12 100644
--- a/home/page/latest_updates/latest_updates.js
+++ b/home/page/latest_updates/latest_updates.js
@@ -1,5 +1,14 @@
 erpnext.updates = [
-	["4rd December 2012", [
+	["5th December 2012", [
+		"Leave Application: Now can set approver.",
+		"New Roles Added: Leave Approver and Expense Approver.",
+		"Production Order is now linked with sales order.",
+		"Production Planning Tool: The field 'Allow SA items as raw material' has been renamed to 'Use multi-level BOM', 'Include in plan' column from SO table has been deleted",
+		"Batch nos are now filtered with item and available qty",
+		"BOM: 'Update Costing' button has been deleted, once submitted cost are fixed.",
+		"[For indian customer only] Deprecated TDS related documents and fields. Old TDS amount added into tax table in Purchase Invoice and entries table in case of JV",
+	]],
+	["4th December 2012", [
 		"POS / Mode of Payment: Select default bank / cash account in Mode of Payment and it will be automatically selected in POS Invoice.",
 		"Email: Add contact name as 'Dear so-and-so' in Email.",
 		"Report Builder: Remember last column setup for users",
@@ -9,6 +18,7 @@
 		"Linked With: Added new Linked with in all Forms.",
 		"Rename Tool: Documents that can be renamed will have a 'Rename' option in the sidebar (wherever applicable).",
 		"Chart of Accounts: Ability to rename / delete from Chart of Accounts.",
+		"Delivery and Billing status now updated in sales order, if POS made against that sales order"
 	]],
 	["30th November 2012", [
 		"Auto Notifications: System will prompt user with pre-set message for auto-notification.",
diff --git a/hr/__init__.py b/hr/__init__.py
index 96bd47b..429c719 100644
--- a/hr/__init__.py
+++ b/hr/__init__.py
@@ -3,4 +3,6 @@
 	{"doctype":"Role", "role_name":"Employee", "name":"Employee"},
 	{"doctype":"Role", "role_name":"HR Manager", "name":"HR Manager"},
 	{"doctype":"Role", "role_name":"HR User", "name":"HR User"},
+	{"doctype":"Role", "role_name":"Leave Approver", "name":"Leave Approver"},
+	{"doctype":"Role", "role_name":"Expense Approver", "name":"Expense Approver"},
 ]
diff --git a/hr/doctype/expense_claim/expense_claim.js b/hr/doctype/expense_claim/expense_claim.js
index 466a8cf..761da88 100644
--- a/hr/doctype/expense_claim/expense_claim.js
+++ b/hr/doctype/expense_claim/expense_claim.js
@@ -15,79 +15,87 @@
 // along with this program.	If not, see <http://www.gnu.org/licenses/>.
 
 cur_frm.add_fetch('employee', 'company', 'company');
+cur_frm.add_fetch('employee','employee_name','employee_name');
 
 cur_frm.cscript.onload = function(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.approval_status)
+		cur_frm.set_value("approval_status", "Draft")
+			
 	if (doc.__islocal) {
-		if(doc.amended_from) set_multiple(cdt,cdn,{approval_status:'Draft'});
-		var val = getchildren('Expense Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
-		for(var i = 0; i<val.length; i++){
-			val[i].sanctioned_amount ='';
-		}
-		doc.total_sanctioned_amount = '';
-		refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
+		cur_frm.set_value("posting_date", dateutil.get_today());
+		if(doc.amended_from) 
+			cur_frm.set_value("approval_status", "Draft");
+		cur_frm.cscript.clear_sanctioned(doc);
 	}
+
+	cur_frm.call({
+		method:"get_approver_list",
+		callback: function(r) {
+			cur_frm.set_df_property("exp_approver", "options", r.message);
+		}
+	});	
+}
+
+cur_frm.cscript.clear_sanctioned = function(doc) {
+	var val = getchildren('Expense Claim Detail', doc.name, 
+		'expense_voucher_details', doc.doctype);
+	for(var i = 0; i<val.length; i++){
+		val[i].sanctioned_amount ='';
+	}
+
+	doc.total_sanctioned_amount = '';
+	refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);	
 }
 
 cur_frm.cscript.refresh = function(doc,cdt,cdn){
-	hide_field('calculate_total_amount');
-	if(user == doc.exp_approver && doc.approval_status == 'Submitted'){
-		unhide_field(['update_voucher', 'approve', 'reject', 'calculate_total_amount']);
-		cur_frm.fields_dict['expense_voucher_details'].grid.set_column_disp('sanctioned_amount', true);
-		set_field_permlevel('remark', 0);
+	cur_frm.set_intro("");
+	if(doc.__islocal && !in_list(user_roles, "HR User")) {
+		cur_frm.set_intro("Fill the form and save it")
 	} else {
-		hide_field(['update_voucher', 'approve', 'reject']);
-		cur_frm.fields_dict['expense_voucher_details'].grid.set_column_disp('sanctioned_amount', false);
-		set_field_permlevel('remark', 1);
+		if(doc.approval_status=="Draft") {		
+			if(in_list(user_roles, "HR User")) {
+				if(doc.approval_status=="Draft") {
+					cur_frm.set_intro("Please Approve (and Submit) or Reject, or re-assign to applicant for further review.");				
+				}
+			} else if(user==doc.exp_approver) {
+				if(doc.approval_status=="Draft") {
+					cur_frm.set_intro("You are the Expense Approver for this record. Please Update the 'Status' and Save");
+					cur_frm.set_df_property("approval_status", "permlevel", 0);
+				}
+			} else {
+				cur_frm.set_intro("Expense Claim is pending approval.");
+			}
+		} else {
+			if(doc.approval_status=="Approved") {
+				cur_frm.set_intro("Expense Claim has been approved.");
+			} else if(doc.approval_status=="Rejected") {
+				cur_frm.set_intro("Expense Claim has been rejected.");
+			}
+		}
 	}
-	if (doc.docstatus == 0) unhide_field('calculate_total_amount');
-}
+	
+	if(doc.approval_status=="Approved" && doc.docstatus==0) {
+		cur_frm.savesubmit()
+	}}
 
 cur_frm.cscript.validate = function(doc) {
-	if(cint(doc.docstatus) == 0) {
-		doc.approval_status = "Draft";
-	}
 	cur_frm.cscript.calculate_total(doc);
 }
 
-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'];
-				wn.meta.get_docfield(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 Claim Detail', doc.name, 'expense_voucher_details', doc.doctype);
-		var total_claim =0;
-		for(var i = 0; i<val.length; i++){
-			val[i].sanctioned_amount = val[i].claim_amount;
-			total_claim = flt(total_claim)+flt(val[i].claim_amount);
-			refresh_field('sactioned_amount', val[i].name, 'expense_voucher_details'); 
+	doc.total_claimed_amount = 0;
+	doc.total_sanctioned_amount = 0;
+	$.each(wn.model.get("Expense Claim Detail", {parent:doc.name}), function(i, d) {
+		doc.total_claimed_amount += d.claim_amount;
+		if(d.sanctioned_amount==null) {
+			d.sanctioned_amount = d.claim_amount;
 		}
-		doc.total_claimed_amount = flt(total_claim);
-		refresh_field('total_claimed_amount');
-	}
-	else if(doc.approval_status == 'Submitted'){
-		var val = getchildren('Expense Claim 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);
-			refresh_field('sactioned_amount', val[i].name, 'expense_voucher_details'); 
-			
-		}
-		doc.total_sanctioned_amount = flt(total_sanctioned);
-		refresh_field('total_sanctioned_amount');
-	}
+		doc.total_sanctioned_amount += d.sanctioned_amount;
+	});
+	
+	refresh_field("total_claimed_amount");
+	refresh_field('total_sanctioned_amount');
+
 }
 
 cur_frm.cscript.calculate_total_amount = function(doc,cdt,cdn){
@@ -100,155 +108,8 @@
 	cur_frm.cscript.calculate_total(doc,cdt,cdn);
 }
 
-cur_frm.cscript.approve = function(doc,cdt,cdn){
-	cur_frm.cscript.calculate_total(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();
-			var args = {
-				type: 'Expense Claim Approved',
-				doctype: 'Expense Claim',
-				contact_name: doc.employee_name,
-				send_to: doc.email_id
-			}
-			cur_frm.cscript.notify(doc, args);
-					}
-					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 Claim can be approved by Approver only");
-	}
-}
-
-cur_frm.cscript.reject = function(doc,cdt,cdn){
-	cur_frm.cscript.calculate_total(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();
-			var args = {
-				type: 'Expense Claim Rejected',
-				doctype: 'Expense Claim',
-				contact_name: doc.employee_name,
-				send_to: doc.email_id
-			}
-			cur_frm.cscript.notify(doc, args);
-					}
-				});
-			}
-		}	
-		
-		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 Claim 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();
-	});
-}
-
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
 	if(cint(wn.boot.notification_settings.expense_claim)) {
 		cur_frm.email_doc(wn.boot.notification_settings.expense_claim_message);
 	}
-}
-
-cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query;
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/hr/doctype/expense_claim/expense_claim.py b/hr/doctype/expense_claim/expense_claim.py
index 0bfc318..bc4e131 100644
--- a/hr/doctype/expense_claim/expense_claim.py
+++ b/hr/doctype/expense_claim/expense_claim.py
@@ -17,86 +17,16 @@
 from __future__ import unicode_literals
 import webnotes
 
-from webnotes.utils import add_days, cstr
-from webnotes.model import db_exists
-from webnotes.model.wrapper import getlist, copy_doclist
-from webnotes.model.code import get_obj
+from webnotes.utils import add_days
+from webnotes.model.wrapper import getlist
 from webnotes import form, msgprint
 
 sql = webnotes.conn.sql
-	
-
 
 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 Claim 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:
-			webnotes.conn.set(self.doc,'total_sanctioned_amount',self.doc.total_sanctioned_amount)
-		if self.doc.remark:
-			webnotes.conn.set(self.doc, 'remark', self.doc.remark)
-	
-	def approve_voucher(self):
-		missing_count = 0
-		for d in getlist(self.doclist, 'expense_voucher_details'):
-			if not d.sanctioned_amount:
-				missing_count += 1
-		if missing_count == len(getlist(self.doclist, 'expense_voucher_details')):
-			msgprint("Please add 'Sanctioned Amount' for atleast one expense")
-			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()
-		
-		webnotes.conn.set(self.doc, 'approval_status', 'Approved')		
-		# on approval notification
-		#get_obj('Notification Control').notify_contact('Expense Claim 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:
-			webnotes.conn.set(self.doc, 'remark', self.doc.remark)	 
-		webnotes.conn.set(self.doc, 'approval_status', 'Rejected')		
-
-		return cstr('Rejected')
-	
 	
 	def validate_fiscal_year(self):
 		fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
@@ -108,30 +38,16 @@
 		
 	def validate(self):
 		self.validate_fiscal_year()
-		
-	def on_update(self):
-		webnotes.conn.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 Claim approver")
-			raise Exception
-		
-	def on_submit(self):
-		self.validate_exp_details()
-		webnotes.conn.set(self.doc, 'approval_status', 'Submitted')
-	
-	def on_cancel(self):
-		webnotes.conn.set(self.doc, 'approval_status', 'Cancelled')
-
-	def get_formatted_message(self, args):
-		""" get formatted message for auto notification"""
-		return get_obj('Notification Control').get_formatted_message(args)
+@webnotes.whitelist()
+def get_approver_list():
+	roles = [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
+		where role='Expense Approver'""")]
+	if not roles:
+		webnotes.msgprint("No Expense Approvers. Please assign 'Expense Approver' Role to atleast one user.")
+	return roles
diff --git a/hr/doctype/expense_claim/expense_claim.txt b/hr/doctype/expense_claim/expense_claim.txt
index 34ed31c..f42e2dd 100644
--- a/hr/doctype/expense_claim/expense_claim.txt
+++ b/hr/doctype/expense_claim/expense_claim.txt
@@ -1,390 +1,271 @@
-# DocType, Expense Claim
 [
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:56',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:45:48',
-		'modified_by': u'Administrator',
-		'owner': u'harshada@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1308808105',
-		'autoname': u'EXP.######',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'doctype': 'DocType',
-		'is_submittable': 1,
-		'module': u'HR',
-		'name': '__common__',
-		'search_fields': u'approval_status,employee,employee_name',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'subject': u'From %(employee_name)s for %(total_claimed_amount)s (claimed)',
-		'tag_fields': u'approval_status',
-		'version': 135
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Expense Claim',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'Expense Claim',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1
-	},
-
-	# DocType, Expense Claim
-	{
-		'doctype': 'DocType',
-		'name': u'Expense Claim'
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'All'
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'match': u'owner',
-		'permlevel': 0,
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'HR Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'HR User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'details',
-		'fieldtype': u'Section Break',
-		'label': u'Details',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'default': u'Draft',
-		'doctype': u'DocField',
-		'fieldname': u'approval_status',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Approval Status',
-		'no_copy': 1,
-		'oldfieldname': u'approval_status',
-		'oldfieldtype': u'Select',
-		'options': u'\nDraft\nSubmitted\nApproved \nRejected\nCancelled',
-		'permlevel': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'employee',
-		'fieldtype': u'Link',
-		'in_filter': 1,
-		'label': u'From Employee',
-		'oldfieldname': u'employee',
-		'oldfieldtype': u'Link',
-		'options': u'Employee',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'employee_name',
-		'fieldtype': u'Data',
-		'in_filter': 1,
-		'label': u'Employee Name',
-		'oldfieldname': u'employee_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'search_index': 0,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'fiscal_year',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Fiscal Year',
-		'oldfieldname': u'fiscal_year',
-		'oldfieldtype': u'Select',
-		'options': u'link:Fiscal Year',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'company',
-		'fieldtype': u'Select',
-		'in_filter': 1,
-		'label': u'Company',
-		'oldfieldname': u'company',
-		'oldfieldtype': u'Link',
-		'options': u'link:Company',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'column_break0',
-		'fieldtype': u'Column Break',
-		'oldfieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'posting_date',
-		'fieldtype': u'Date',
-		'in_filter': 1,
-		'label': u'Posting Date',
-		'oldfieldname': u'posting_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'exp_approver',
-		'fieldtype': u'Select',
-		'label': u'Approver',
-		'oldfieldname': u'exp_approver',
-		'oldfieldtype': u'Select',
-		'permlevel': 0,
-		'width': u'160px'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'remark',
-		'fieldtype': u'Small Text',
-		'label': u'Remark',
-		'no_copy': 1,
-		'oldfieldname': u'remark',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'amended_from',
-		'fieldtype': u'Data',
-		'label': u'Amended From',
-		'no_copy': 1,
-		'oldfieldname': u'amended_from',
-		'oldfieldtype': u'Data',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1,
-		'width': u'160px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'amendment_date',
-		'fieldtype': u'Date',
-		'label': u'Amendment Date',
-		'no_copy': 1,
-		'oldfieldname': u'amendment_date',
-		'oldfieldtype': u'Date',
-		'permlevel': 1,
-		'print_hide': 1,
-		'report_hide': 1,
-		'width': u'160px'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'approve',
-		'fieldtype': u'Button',
-		'hidden': 1,
-		'label': u'Approve',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'reject',
-		'fieldtype': u'Button',
-		'hidden': 1,
-		'label': u'Reject',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'expense_details',
-		'fieldtype': u'Section Break',
-		'label': u'Expense Details',
-		'oldfieldtype': u'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'calculate_total_amount',
-		'fieldtype': u'Button',
-		'label': u'Calculate Total Amount',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'total_claimed_amount',
-		'fieldtype': u'Currency',
-		'in_filter': 0,
-		'label': u'Total Claimed Amount',
-		'no_copy': 1,
-		'oldfieldname': u'total_claimed_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'reqd': 0,
-		'width': u'160px'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'total_sanctioned_amount',
-		'fieldtype': u'Currency',
-		'in_filter': 0,
-		'label': u'Total Sanctioned Amount',
-		'no_copy': 1,
-		'oldfieldname': u'total_sanctioned_amount',
-		'oldfieldtype': u'Currency',
-		'permlevel': 1,
-		'width': u'160px'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'update_voucher',
-		'fieldtype': u'Button',
-		'hidden': 1,
-		'label': u'Update Voucher',
-		'oldfieldtype': u'Button',
-		'permlevel': 0,
-		'print_hide': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'expense_voucher_details',
-		'fieldtype': u'Table',
-		'label': u'Expense Claim Details',
-		'oldfieldname': u'expense_voucher_details',
-		'oldfieldtype': u'Table',
-		'options': u'Expense Claim Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'email_id',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'label': u'Employees Email Id',
-		'oldfieldname': u'email_id',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'print_hide': 1
-	}
+ {
+  "owner": "harshada@webnotestech.com", 
+  "docstatus": 0, 
+  "creation": "2012-12-05 14:11:53", 
+  "modified_by": "Administrator", 
+  "modified": "2012-12-05 14:22:27"
+ }, 
+ {
+  "is_submittable": 1, 
+  "autoname": "EXP.######", 
+  "name": "__common__", 
+  "default_print_format": "Standard", 
+  "search_fields": "approval_status,employee,employee_name", 
+  "module": "HR", 
+  "doctype": "DocType"
+ }, 
+ {
+  "name": "__common__", 
+  "parent": "Expense Claim", 
+  "doctype": "DocField", 
+  "parenttype": "DocType", 
+  "parentfield": "fields"
+ }, 
+ {
+  "name": "__common__", 
+  "parent": "Expense Claim", 
+  "read": 1, 
+  "doctype": "DocPerm", 
+  "parenttype": "DocType", 
+  "parentfield": "permissions"
+ }, 
+ {
+  "name": "Expense Claim", 
+  "doctype": "DocType"
+ }, 
+ {
+  "oldfieldtype": "Section Break", 
+  "doctype": "DocField", 
+  "label": "Details", 
+  "fieldname": "details", 
+  "fieldtype": "Section Break", 
+  "permlevel": 0
+ }, 
+ {
+  "permlevel": 1, 
+  "no_copy": 1, 
+  "oldfieldtype": "Select", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Approval Status", 
+  "oldfieldname": "approval_status", 
+  "default": "Draft", 
+  "fieldname": "approval_status", 
+  "fieldtype": "Select", 
+  "search_index": 1, 
+  "options": "\nDraft\nApproved\nRejected", 
+  "in_filter": 1
+ }, 
+ {
+  "oldfieldtype": "Select", 
+  "doctype": "DocField", 
+  "label": "Approver", 
+  "oldfieldname": "exp_approver", 
+  "width": "160px", 
+  "fieldname": "exp_approver", 
+  "fieldtype": "Select", 
+  "permlevel": 0
+ }, 
+ {
+  "oldfieldtype": "Date", 
+  "doctype": "DocField", 
+  "label": "Posting Date", 
+  "oldfieldname": "posting_date", 
+  "fieldname": "posting_date", 
+  "fieldtype": "Date", 
+  "reqd": 1, 
+  "permlevel": 0, 
+  "in_filter": 1
+ }, 
+ {
+  "oldfieldtype": "Column Break", 
+  "doctype": "DocField", 
+  "width": "50%", 
+  "fieldname": "column_break0", 
+  "fieldtype": "Column Break", 
+  "permlevel": 0
+ }, 
+ {
+  "oldfieldtype": "Link", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "From Employee", 
+  "oldfieldname": "employee", 
+  "permlevel": 0, 
+  "trigger": "Client", 
+  "fieldname": "employee", 
+  "fieldtype": "Link", 
+  "search_index": 1, 
+  "reqd": 1, 
+  "options": "Employee", 
+  "in_filter": 1
+ }, 
+ {
+  "oldfieldtype": "Data", 
+  "doctype": "DocField", 
+  "label": "Employee Name", 
+  "oldfieldname": "employee_name", 
+  "width": "150px", 
+  "fieldname": "employee_name", 
+  "fieldtype": "Data", 
+  "search_index": 0, 
+  "permlevel": 1, 
+  "in_filter": 1
+ }, 
+ {
+  "no_copy": 1, 
+  "oldfieldtype": "Small Text", 
+  "colour": "White:FFF", 
+  "allow_on_submit": 0, 
+  "doctype": "DocField", 
+  "label": "Remark", 
+  "oldfieldname": "remark", 
+  "fieldname": "remark", 
+  "fieldtype": "Small Text", 
+  "permlevel": 0
+ }, 
+ {
+  "print_hide": 1, 
+  "no_copy": 1, 
+  "oldfieldtype": "Data", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Amended From", 
+  "oldfieldname": "amended_from", 
+  "width": "160px", 
+  "fieldname": "amended_from", 
+  "fieldtype": "Data", 
+  "permlevel": 1, 
+  "report_hide": 1
+ }, 
+ {
+  "print_hide": 1, 
+  "no_copy": 1, 
+  "oldfieldtype": "Date", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Amendment Date", 
+  "oldfieldname": "amendment_date", 
+  "width": "160px", 
+  "fieldname": "amendment_date", 
+  "fieldtype": "Date", 
+  "permlevel": 1, 
+  "report_hide": 1
+ }, 
+ {
+  "oldfieldtype": "Section Break", 
+  "doctype": "DocField", 
+  "label": "Expense Details", 
+  "fieldname": "expense_details", 
+  "fieldtype": "Section Break", 
+  "permlevel": 0
+ }, 
+ {
+  "oldfieldtype": "Table", 
+  "allow_on_submit": 0, 
+  "doctype": "DocField", 
+  "label": "Expense Claim Details", 
+  "oldfieldname": "expense_voucher_details", 
+  "options": "Expense Claim Detail", 
+  "fieldname": "expense_voucher_details", 
+  "fieldtype": "Table", 
+  "permlevel": 0
+ }, 
+ {
+  "no_copy": 1, 
+  "oldfieldtype": "Currency", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Total Claimed Amount", 
+  "oldfieldname": "total_claimed_amount", 
+  "width": "160px", 
+  "fieldname": "total_claimed_amount", 
+  "fieldtype": "Currency", 
+  "reqd": 0, 
+  "permlevel": 1, 
+  "in_filter": 0
+ }, 
+ {
+  "no_copy": 1, 
+  "oldfieldtype": "Currency", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Total Sanctioned Amount", 
+  "oldfieldname": "total_sanctioned_amount", 
+  "width": "160px", 
+  "fieldname": "total_sanctioned_amount", 
+  "fieldtype": "Currency", 
+  "permlevel": 1, 
+  "in_filter": 0
+ }, 
+ {
+  "print_hide": 1, 
+  "oldfieldtype": "Data", 
+  "doctype": "DocField", 
+  "label": "Employees Email Id", 
+  "oldfieldname": "email_id", 
+  "fieldname": "email_id", 
+  "fieldtype": "Data", 
+  "hidden": 1, 
+  "permlevel": 0
+ }, 
+ {
+  "oldfieldtype": "Select", 
+  "doctype": "DocField", 
+  "label": "Fiscal Year", 
+  "oldfieldname": "fiscal_year", 
+  "options": "link:Fiscal Year", 
+  "fieldname": "fiscal_year", 
+  "fieldtype": "Select", 
+  "reqd": 1, 
+  "permlevel": 0, 
+  "in_filter": 1
+ }, 
+ {
+  "oldfieldtype": "Link", 
+  "doctype": "DocField", 
+  "label": "Company", 
+  "oldfieldname": "company", 
+  "options": "link:Company", 
+  "fieldname": "company", 
+  "fieldtype": "Select", 
+  "reqd": 1, 
+  "permlevel": 0, 
+  "in_filter": 1
+ }, 
+ {
+  "create": 1, 
+  "doctype": "DocPerm", 
+  "write": 1, 
+  "role": "Employee", 
+  "permlevel": 0, 
+  "match": "owner"
+ }, 
+ {
+  "amend": 1, 
+  "create": 1, 
+  "doctype": "DocPerm", 
+  "submit": 1, 
+  "write": 1, 
+  "cancel": 1, 
+  "role": "Expense Approver", 
+  "permlevel": 0, 
+  "match": "exp_approver:user"
+ }, 
+ {
+  "amend": 1, 
+  "create": 1, 
+  "doctype": "DocPerm", 
+  "submit": 1, 
+  "write": 1, 
+  "cancel": 1, 
+  "role": "HR User", 
+  "permlevel": 0
+ }, 
+ {
+  "doctype": "DocPerm", 
+  "role": "All", 
+  "permlevel": 1
+ }
 ]
\ No newline at end of file
diff --git a/hr/doctype/expense_claim_detail/expense_claim_detail.txt b/hr/doctype/expense_claim_detail/expense_claim_detail.txt
index a11ce5c..f28811f 100644
--- a/hr/doctype/expense_claim_detail/expense_claim_detail.txt
+++ b/hr/doctype/expense_claim_detail/expense_claim_detail.txt
@@ -1,103 +1,80 @@
-# DocType, Expense Claim Detail
 [
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-03-27 14:35:56',
-		'docstatus': 0,
-		'modified': '2012-03-27 14:35:56',
-		'modified_by': u'Administrator',
-		'owner': u'harshada@webnotestech.com'
-	},
-
-	# These values are common for all DocType
-	{
-		'colour': u'White:FFF',
-		'doctype': 'DocType',
-		'istable': 1,
-		'module': u'HR',
-		'name': '__common__',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'version': 5
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Expense Claim Detail',
-		'parentfield': u'fields',
-		'parenttype': u'DocType',
-		'permlevel': 0
-	},
-
-	# DocType, Expense Claim Detail
-	{
-		'doctype': 'DocType',
-		'name': u'Expense Claim Detail'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'expense_date',
-		'fieldtype': u'Date',
-		'label': u'Expense Date',
-		'oldfieldname': u'expense_date',
-		'oldfieldtype': u'Date',
-		'reqd': 0,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'expense_type',
-		'fieldtype': u'Link',
-		'label': u'Expense Claim Type',
-		'oldfieldname': u'expense_type',
-		'oldfieldtype': u'Link',
-		'options': u'Expense Claim Type',
-		'reqd': 1,
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'description',
-		'fieldtype': u'Small Text',
-		'label': u'Description',
-		'oldfieldname': u'description',
-		'oldfieldtype': u'Small Text',
-		'width': u'300px'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'claim_amount',
-		'fieldtype': u'Currency',
-		'label': u'Claim Amount',
-		'oldfieldname': u'claim_amount',
-		'oldfieldtype': u'Currency',
-		'reqd': 1,
-		'trigger': u'Client',
-		'width': u'150px'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': u'DocField',
-		'fieldname': u'sanctioned_amount',
-		'fieldtype': u'Currency',
-		'label': u'Sanctioned Amount',
-		'no_copy': 1,
-		'oldfieldname': u'sanctioned_amount',
-		'oldfieldtype': u'Currency',
-		'trigger': u'Client',
-		'width': u'150px'
-	}
+ {
+  "owner": "harshada@webnotestech.com", 
+  "docstatus": 0, 
+  "creation": "2012-07-03 13:30:39", 
+  "modified_by": "Administrator", 
+  "modified": "2012-12-05 14:22:03"
+ }, 
+ {
+  "istable": 1, 
+  "name": "__common__", 
+  "doctype": "DocType", 
+  "module": "HR"
+ }, 
+ {
+  "name": "__common__", 
+  "parent": "Expense Claim Detail", 
+  "doctype": "DocField", 
+  "parenttype": "DocType", 
+  "permlevel": 0, 
+  "parentfield": "fields"
+ }, 
+ {
+  "name": "Expense Claim Detail", 
+  "doctype": "DocType"
+ }, 
+ {
+  "oldfieldtype": "Date", 
+  "doctype": "DocField", 
+  "label": "Expense Date", 
+  "oldfieldname": "expense_date", 
+  "width": "150px", 
+  "fieldname": "expense_date", 
+  "fieldtype": "Date", 
+  "reqd": 0
+ }, 
+ {
+  "oldfieldtype": "Link", 
+  "doctype": "DocField", 
+  "label": "Expense Claim Type", 
+  "oldfieldname": "expense_type", 
+  "width": "150px", 
+  "fieldname": "expense_type", 
+  "fieldtype": "Select", 
+  "reqd": 1, 
+  "options": "link:Expense Claim Type"
+ }, 
+ {
+  "oldfieldtype": "Small Text", 
+  "doctype": "DocField", 
+  "label": "Description", 
+  "oldfieldname": "description", 
+  "width": "300px", 
+  "fieldname": "description", 
+  "fieldtype": "Small Text"
+ }, 
+ {
+  "oldfieldtype": "Currency", 
+  "doctype": "DocField", 
+  "label": "Claim Amount", 
+  "oldfieldname": "claim_amount", 
+  "width": "150px", 
+  "trigger": "Client", 
+  "fieldname": "claim_amount", 
+  "fieldtype": "Currency", 
+  "reqd": 1
+ }, 
+ {
+  "no_copy": 1, 
+  "oldfieldtype": "Currency", 
+  "allow_on_submit": 0, 
+  "doctype": "DocField", 
+  "label": "Sanctioned Amount", 
+  "oldfieldname": "sanctioned_amount", 
+  "width": "150px", 
+  "trigger": "Client", 
+  "fieldname": "sanctioned_amount", 
+  "fieldtype": "Currency"
+ }
 ]
\ No newline at end of file
diff --git a/hr/doctype/leave_application/leave_application.js b/hr/doctype/leave_application/leave_application.js
index 00df476..64c1e24 100755
--- a/hr/doctype/leave_application/leave_application.js
+++ b/hr/doctype/leave_application/leave_application.js
@@ -8,14 +8,21 @@
 // 
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 // GNU General Public License for more details.
 // 
 // You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// along with this program.	If not, see <http://www.gnu.org/licenses/>.
 
 cur_frm.cscript.onload = function(doc, dt, dn) {
-  if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
+	if(!doc.posting_date) 
+		set_multiple(dt,dn,{posting_date:get_today()});
+	cur_frm.call({
+		method:"get_approver_list",
+		callback: function(r) {
+			cur_frm.set_df_property("leave_approver", "options", r.message);
+		}
+	});
 }
 
 cur_frm.cscript.refresh = function(doc, dt, dn) {
@@ -23,14 +30,17 @@
 	if(doc.__islocal && !in_list(user_roles, "HR User")) {
 		cur_frm.set_intro("Fill the form and save it")
 	} else {
-		if(in_list(user_roles, "HR User")) {
-			if(doc.status=="Open") {
+		if(doc.status=="Open") {
+			if(in_list(user_roles, "HR User")) {
 				cur_frm.set_intro("Please Approve (and Submit) or Reject, or re-assign to applicant for further review.");				
+			} else if(user==doc.leave_approver) {
+				cur_frm.set_intro("You are the Leave Approver for this record. Please Update the 'Status' and Save");
+				cur_frm.set_df_property("status", "permlevel", 2);
+			} else {
+				cur_frm.set_intro("This Leave Application is pending approval.")
 			}
 		} else {
-			if(doc.status=="Open") {
-				cur_frm.set_intro("Leave application is pending approval.");
-			} else if(doc.status=="Approved") {
+ 			if(doc.status=="Approved") {
 				cur_frm.set_intro("Leave application has been approved.");
 			} else if(doc.status=="Rejected") {
 				cur_frm.set_intro("Leave application has been rejected.");
@@ -38,7 +48,7 @@
 		}
 	}
 	
-	if(doc.status=="Approved" && doc.docstatus!=1) {
+	if(doc.status=="Approved" && doc.docstatus==0) {
 		cur_frm.savesubmit()
 	}
 }
@@ -46,53 +56,61 @@
 cur_frm.add_fetch('employee','employee_name','employee_name');
 
 cur_frm.cscript.employee = function (doc, dt, dn){
-  get_leave_balance(doc, dt, dn);
+	get_leave_balance(doc, dt, dn);
 }
 
 cur_frm.cscript.fiscal_year = function (doc, dt, dn){
-  get_leave_balance(doc, dt, dn);
+	get_leave_balance(doc, dt, dn);
 }
 
 cur_frm.cscript.leave_type = function (doc, dt, dn){
-  get_leave_balance(doc, dt, dn);
+	get_leave_balance(doc, dt, dn);
 }
 
 cur_frm.cscript.half_day = function(doc, dt, dn) {
-  if(doc.from_date) {
-    set_multiple(dt,dn,{to_date:doc.from_date});
-    calculate_total_days(doc, dt, dn);
-  }
+	if(doc.from_date) {
+		set_multiple(dt,dn,{to_date:doc.from_date});
+		calculate_total_days(doc, dt, dn);
+	}
 }
 
 cur_frm.cscript.from_date = function(doc, dt, dn) {
-  if(cint(doc.half_day) == 1){
-    set_multiple(dt,dn,{to_date:doc.from_date});
-  }
-  calculate_total_days(doc, dt, dn);
+	if(cint(doc.half_day) == 1){
+		set_multiple(dt,dn,{to_date:doc.from_date});
+	}
+	calculate_total_days(doc, dt, dn);
 }
 
 cur_frm.cscript.to_date = function(doc, dt, dn) {
-  if(cint(doc.half_day) == 1 && cstr(doc.from_date) && doc.from_date != doc.to_date){
-    msgprint("To Date should be same as From Date for Half Day leave");
-    set_multiple(dt,dn,{to_date:doc.from_date});    
-  }
-  calculate_total_days(doc, dt, dn);
+	if(cint(doc.half_day) == 1 && cstr(doc.from_date) && doc.from_date != doc.to_date){
+		msgprint("To Date should be same as From Date for Half Day leave");
+		set_multiple(dt,dn,{to_date:doc.from_date});		
+	}
+	calculate_total_days(doc, dt, dn);
 }
-
+	
 get_leave_balance = function(doc, dt, dn) {
-  if(doc.employee && doc.leave_type && doc.fiscal_year)
-    get_server_fields('get_leave_balance', '','', doc, dt, dn, 1);
+	if(doc.employee && doc.leave_type && doc.fiscal_year) {
+		cur_frm.call({
+			method: "get_leave_balance",
+			args: {
+				employee: doc.name,
+				fiscal_year: doc.fiscal_year,
+				leave_type: doc.leave_type
+			}
+		})		
+	}
 }
 
 calculate_total_days = function(doc, dt, dn) {
-  if(doc.from_date && doc.to_date){
-    if(cint(doc.half_day) == 1) set_multiple(dt,dn,{total_leave_days:0.5});
-    else{
-      //d = new DateFn();
-      //set_multiple(dt,dn,{total_leave_days:d.get_diff(d.str_to_obj(doc.to_date),d.str_to_obj(doc.from_date))+1});
-      get_server_fields('get_total_leave_days', '', '', doc, dt, dn, 1);
-    }
-  }
+	if(doc.from_date && doc.to_date){
+		if(cint(doc.half_day) == 1) set_multiple(dt,dn,{total_leave_days:0.5});
+		else{
+			//d = new DateFn();
+			//set_multiple(dt,dn,{total_leave_days:d.get_diff(d.str_to_obj(doc.to_date),d.str_to_obj(doc.from_date))+1});
+			get_server_fields('get_total_leave_days', '', '', doc, dt, dn, 1);
+		}
+	}
 }
 
 cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query;
\ No newline at end of file
diff --git a/hr/doctype/leave_application/leave_application.py b/hr/doctype/leave_application/leave_application.py
index 91c9d8c..1cf23ac 100755
--- a/hr/doctype/leave_application/leave_application.py
+++ b/hr/doctype/leave_application/leave_application.py
@@ -30,14 +30,6 @@
 		self.doc = doc
 		self.doclist = doclist 
 
-	def get_leave_balance(self):
-		leave_all = sql("select total_leaves_allocated 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))
-		leave_all = leave_all and flt(leave_all[0][0]) or 0
-		leave_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, self.doc.fiscal_year))
-		leave_app = leave_app and flt(leave_app[0][0]) or 0
-		ret = {'leave_balance':leave_all - leave_app}
-		return ret
-
 	def get_holidays(self):
 		"""
 			get total holidays
@@ -71,7 +63,7 @@
 
 	def validate_balance_leaves(self):
 		if self.doc.from_date and self.doc.to_date and not self.is_lwp():
-			bal = self.get_leave_balance()
+			bal = get_leave_balance(self.doc.leave_type, self.doc.employee, self.doc.fiscal_year)
 			tot_leaves = self.get_total_leave_days()
 			bal, tot_leaves = bal, tot_leaves
 			webnotes.conn.set(self.doc,'leave_balance',flt(bal['leave_balance']))
@@ -107,3 +99,29 @@
 		if self.doc.status != "Approved":
 			webnotes.msgprint("""Only Approved Leave Applications can be Submitted.""",
 				raise_exception=True)
+
+@webnotes.whitelist()
+def get_leave_balance(employee, leave_type, fiscal_year):
+	leave_all = webnotes.conn.sql("""select total_leaves_allocated 
+		from `tabLeave Allocation` where employee = '%s' and leave_type = '%s' 
+		and fiscal_year = '%s' and docstatus = 1""" % (employee, 
+			leave_type, fiscal_year))
+
+	leave_all = leave_all and flt(leave_all[0][0]) or 0
+	leave_app = webnotes.conn.sql("""select SUM(total_leave_days) 
+		from `tabLeave Application` 
+		where employee = '%s' 
+		and leave_type = '%s' and fiscal_year = '%s' 
+		and docstatus = 1""" % (employee, leave_type, fiscal_year))
+	leave_app = leave_app and flt(leave_app[0][0]) or 0
+	ret = {'leave_balance':leave_all - leave_app}
+	return ret
+
+@webnotes.whitelist()
+def get_approver_list():
+	roles = [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
+		where role='Leave Approver'""")]
+	if not roles:
+		webnotes.msgprint("No Leave Approvers. Please assign 'Leave Approver' Role to atleast one user.")
+		
+	return roles
diff --git a/hr/doctype/leave_application/leave_application.txt b/hr/doctype/leave_application/leave_application.txt
index 6a33df6..35a16a9 100644
--- a/hr/doctype/leave_application/leave_application.txt
+++ b/hr/doctype/leave_application/leave_application.txt
@@ -2,9 +2,9 @@
  {
   "owner": "Administrator", 
   "docstatus": 0, 
-  "creation": "2012-11-02 17:16:54", 
+  "creation": "2012-12-03 10:13:48", 
   "modified_by": "Administrator", 
-  "modified": "2012-11-30 12:17:27"
+  "modified": "2012-12-05 11:59:15"
  }, 
  {
   "is_submittable": 1, 
@@ -45,6 +45,15 @@
   "permlevel": 3
  }, 
  {
+  "description": "Leave can be approved by users with Role, \"Leave Approver\"", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Leave Approver", 
+  "fieldname": "leave_approver", 
+  "fieldtype": "Select", 
+  "permlevel": 0
+ }, 
+ {
   "search_index": 1, 
   "doctype": "DocField", 
   "label": "Leave Type", 
@@ -216,12 +225,29 @@
   "permlevel": 0
  }, 
  {
+  "amend": 1, 
+  "create": 1, 
+  "doctype": "DocPerm", 
+  "submit": 1, 
+  "write": 1, 
+  "role": "Leave Approver", 
+  "cancel": 1, 
+  "permlevel": 0, 
+  "match": "leave_approver:user"
+ }, 
+ {
+  "doctype": "DocPerm", 
+  "write": 1, 
+  "role": "HR User", 
+  "permlevel": 2
+ }, 
+ {
   "amend": 0, 
   "create": 0, 
   "doctype": "DocPerm", 
   "submit": 0, 
   "write": 1, 
-  "role": "HR User", 
+  "role": "Leave Approver", 
   "cancel": 0, 
   "permlevel": 2
  }, 
diff --git a/hr/doctype/leave_control_panel/leave_control_panel.py b/hr/doctype/leave_control_panel/leave_control_panel.py
index a2d4fee..c81575c 100644
--- a/hr/doctype/leave_control_panel/leave_control_panel.py
+++ b/hr/doctype/leave_control_panel/leave_control_panel.py
@@ -49,7 +49,7 @@
     emp_query = "select name from `tabEmployee` "
     if flag == 1:
       emp_query += condition 
-    e = sql(emp_query)
+    e = sql(emp_query, debug=1)
     return e
 
   # ----------------
diff --git a/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.py b/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.py
index cb82210..5b8ed08 100644
--- a/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.py
+++ b/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.py
@@ -15,6 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from __future__ import unicode_literals
+
 leave_types = sql("""
 	SELECT name FROM `tabLeave Type`
 	WHERE
@@ -57,7 +58,7 @@
 		if d[3] in colnames:
 			# If exists, then append the leave type data
 			if exists:
-				res[ind][colnames.index(d[3])] = d[4] - d[5]
+				res[ind][colnames.index(d[3])] = flt(d[4]) - flt(d[5])
 				res[ind][len(colnames)-1] = sum(res[ind][3:-1])
 			# Else create a new row in res
 			else:
@@ -65,7 +66,7 @@
 				new_row[0] = d[0]
 				new_row[1] = d[1]
 				new_row[2] = d[2]
-				new_row[colnames.index(d[3])] = d[4] - d[5]
+				new_row[colnames.index(d[3])] = flt(d[4]) - flt(d[5])
 				new_row[len(colnames)-1] = sum(new_row[3:-1])
 				res.append(new_row)
 except Exception, e:
diff --git a/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.sql b/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.sql
index 50811c0..454772a 100644
--- a/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.sql
+++ b/hr/search_criteria/employee_leave_balance_report/employee_leave_balance_report.sql
@@ -6,14 +6,13 @@
 	leave_alloc.total_leaves_allocated AS 'total_leaves_allocated',
 	SUM(leave_app.total_leave_days) AS 'total_leaves_applied'
 FROM
-	`tabLeave Allocation` AS leave_alloc,
-	`tabLeave Application` AS leave_app
-WHERE
-	leave_alloc.employee=leave_app.employee AND
+	`tabLeave Allocation` AS leave_alloc LEFT JOIN `tabLeave Application` AS leave_app
+	ON leave_alloc.employee=leave_app.employee AND
 	leave_alloc.leave_type=leave_app.leave_type AND
 	leave_alloc.fiscal_year=leave_app.fiscal_year AND
-	leave_alloc.docstatus=1 AND
-	leave_app.docstatus=1 AND
+	leave_app.docstatus=1
+WHERE
+	leave_alloc.docstatus=1  AND
 	leave_alloc.fiscal_year LIKE '%(fiscal_year)s%%' AND
 	leave_alloc.employee_name LIKE '%(employee_name)s%%'
 GROUP BY
diff --git a/patches/december_2012/__init__.py b/patches/december_2012/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/patches/december_2012/__init__.py
diff --git a/patches/december_2012/deprecate_tds.py b/patches/december_2012/deprecate_tds.py
new file mode 100644
index 0000000..e351fd9
--- /dev/null
+++ b/patches/december_2012/deprecate_tds.py
@@ -0,0 +1,42 @@
+def execute():
+	import webnotes
+	from webnotes.model import delete_doc
+	from webnotes.model.code import get_obj
+	from webnotes.model.doc import addchild
+	
+	# delete doctypes and tables
+	for dt in ["TDS Payment", "TDS Return Acknowledgement", "Form 16A", 
+			"TDS Rate Chart", "TDS Category", "TDS Control", "TDS Detail", 
+			"TDS Payment Detail", "TDS Rate Detail", "TDS Category Account",
+			"Form 16A Ack Detail", "Form 16A Tax Detail"]:
+		delete_doc("DocType", dt)
+		
+		webnotes.conn.commit()
+		webnotes.conn.sql("drop table if exists `tab%s`" % dt)
+		webnotes.conn.begin()
+			
+	delete_doc("Search Criteria", "tds_return")
+			
+	# Add tds entry in tax table for purchase invoice
+	pi_list = webnotes.conn.sql("""select name from `tabPurchase Invoice` 
+		where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0""")
+	for pi in pi_list:
+		piobj = get_obj("Purchase Invoice", pi[0], with_children=1)
+		ch = addchild(piobj.doc, 'taxes_and_charges', 'Purchase Taxes and Charges')
+		ch.charge_type = "Actual"
+		ch.account_head = piobj.doc.tax_code
+		ch.description = piobj.doc.tax_code
+		ch.rate = -1*piobj.doc.ded_amount
+		ch.tax_amount = -1*piobj.doc.ded_amount
+		ch.category = "Total"
+		ch.save(1)		
+	
+	# Add tds entry in entries table for journal voucher
+	jv_list = webnotes.conn.sql("""select name from `tabJournal Voucher` 
+		where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0""")
+	for jv in jv_list:
+		jvobj = get_obj("Journal Voucher", jv[0], with_children=1)
+		ch = addchild(jvobj.doc, 'entries', 'Journal Voucher Detail')
+		ch.account = jvobj.doc.tax_code
+		ch.credit = jvobj.doc.ded_amount
+		ch.save(1)
\ No newline at end of file
diff --git a/patches/december_2012/expense_leave_reload.py b/patches/december_2012/expense_leave_reload.py
new file mode 100644
index 0000000..a3c621f
--- /dev/null
+++ b/patches/december_2012/expense_leave_reload.py
@@ -0,0 +1,26 @@
+import webnotes
+
+def execute():
+	# new roles
+	roles = [r[0] for r in webnotes.conn.sql("""select name from tabRole""")]:
+	if not "Leave Approver" in roles:
+		webnotes.model_wrapper([{"doctype":"Role", "role_name":"Leave Approver", 
+			"__islocal":1, "module":"HR"}]).save()
+	if not "Expense Approver" in roles:
+		webnotes.model_wrapper([{"doctype":"Role", "role_name":"Expense Approver", 
+			"__islocal":1, "module":"HR"}]).save()
+
+	# reload
+	webnotes.clear_perms("Leave Application")
+	webnotes.reload_doc("hr", "doctype", "leave_application")
+
+	webnotes.clear_perms("Expense Claim")
+	webnotes.reload_doc("hr", "doctype", "expense_claim")
+	
+	# remove extra space in Approved Expense Vouchers
+	webnotes.conn.sql("""update `tabExpense Claim` set approval_status='Approved'
+		where approval_status='Approved '""")
+
+	webnotes.conn.commit()
+	for t in ['__CacheItem', '__SessionCache', 'tabSupport Ticket Response']:
+		webnotes.conn.sql("drop table if exists `%s`" % t)
\ No newline at end of file
diff --git a/patches/december_2012/repost_ordered_qty.py b/patches/december_2012/repost_ordered_qty.py
new file mode 100644
index 0000000..c798b6c
--- /dev/null
+++ b/patches/december_2012/repost_ordered_qty.py
@@ -0,0 +1,17 @@
+def execute():
+	import webnotes
+	from webnotes.utils import flt
+	bins = webnotes.conn.sql("select item_code, warehouse, name, ordered_qty from `tabBin`")
+	for d in bins:
+		ordered_qty = webnotes.conn.sql("""
+			select sum(ifnull(po_item.qty, 0) - ifnull(po_item.received_qty, 0)) 
+			from `tabPurchase Order Item` po_item, `tabPurchase Order` po
+			where po_item.parent = po.name and po.docstatus = 1 and po.status != 'Stopped' 
+			and po_item.item_code = %s and po_item.warehouse = %s
+		""", (d[0], d[1]))
+
+		if flt(d[3]) != flt(ordered_qty[0][0]):
+			print d[3], ordered_qty[0][0]
+			
+			webnotes.conn.sql("""update `tabBin` set ordered_qty = %s where name = %s""",
+			 	(ordered_qty and ordered_qty[0][0] or 0, d[2]))
\ No newline at end of file
diff --git a/patches/december_2012/repost_projected_qty.py b/patches/december_2012/repost_projected_qty.py
new file mode 100644
index 0000000..4e4f522
--- /dev/null
+++ b/patches/december_2012/repost_projected_qty.py
@@ -0,0 +1,5 @@
+def execute():
+	import webnotes
+	webnotes.conn.sql("""update `tabBin` 
+		set projected_qty = ifnull(actual_qty, 0) + ifnull(indented_qty, 0) + 
+			ifnull(ordered_qty, 0) + ifnull(planned_qty, 0) - ifnull(reserved_qty, 0)""")
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 1e54d5b..88a7773 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -705,4 +705,20 @@
 		'patch_module': 'patches.november_2012',
 		'patch_file': 'gle_floating_point_issue',
 	},
+	{
+		'patch_module': 'patches.december_2012',
+		'patch_file': 'deprecate_tds',
+	},
+	{
+		'patch_module': 'patches.december_2012',
+		'patch_file': 'expense_leave_reload',
+	},
+	{
+		'patch_module': 'patches.december_2012',
+		'patch_file': 'repost_ordered_qty',
+	},
+	{
+		'patch_module': 'patches.december_2012',
+		'patch_file': 'repost_projected_qty',
+	},
 ]
\ No newline at end of file
diff --git a/production/doctype/bom/bom.js b/production/doctype/bom/bom.js
index dd32fe4..9dffd6c 100644
--- a/production/doctype/bom/bom.js
+++ b/production/doctype/bom/bom.js
@@ -8,11 +8,11 @@
 // 
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 // GNU General Public License for more details.
 // 
 // You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+// along with this program.	If not, see <http://www.gnu.org/licenses/>.
 
 // On REFRESH
 cur_frm.cscript.refresh = function(doc,dt,dn){
@@ -50,33 +50,42 @@
 cur_frm.cscript.time_in_mins = cur_frm.cscript.hour_rate;
 
 
-cur_frm.cscript.item_code = function(doc,dt,dn) {
-	get_bom_material_detail(doc, dt, dn);
+cur_frm.cscript.item_code = function(doc, cdt, cdn) {
+	get_bom_material_detail(doc, cdt, cdn);
 }
 
 
-cur_frm.cscript.bom_no  = function(doc,dt,dn) {
-	get_bom_material_detail(doc, dt, dn);
+cur_frm.cscript.bom_no	= function(doc, cdt, cdn) {
+	get_bom_material_detail(doc, cdt, cdn);
 }
 
-
-var get_bom_material_detail= function(doc,dt,dn) {
-	var d = locals[dt][dn];
-	var callback = function(doc, dt, dn) {
-		calculate_rm_cost(doc, dt, dn);
-		calculate_total(doc);
-	}
-
-	var bom_no = (d.bom_no!=null) ? d.bom_no:''
+var get_bom_material_detail= function(doc, cdt, cdn) {
+	var d = locals[cdt][cdn];
 	if (d.item_code) {
-		arg = {'item_code': d.item_code, 'bom_no': bom_no, 'qty': d.qty};
-		get_server_fields('get_bom_material_detail', JSON.stringify(arg), 'bom_materials', doc, dt, dn, 1, callback);
+		wn.call({
+			doc: cur_frm.doc,
+			method: "get_bom_material_detail",
+			args: {
+				'item_code': d.item_code, 
+				'bom_no': d.bom_no != null ? d.bom_no: '',
+				'qty': d.qty
+			},
+			callback: function(r) {
+				d = locals[cdt][cdn];
+				$.extend(d, r.message);
+				refresh_field("bom_materials");
+				doc = locals[doc.doctype][doc.name];
+				calculate_rm_cost(doc, cdt, cdn);
+				calculate_total(doc);
+			},
+			freeze: true
+		});
 	}
 }
 
 
-cur_frm.cscript.qty = function(doc, dt, dn) {
-	calculate_rm_cost(doc, dt, dn);
+cur_frm.cscript.qty = function(doc, cdt, cdn) {
+	calculate_rm_cost(doc, cdt, cdn);
 	calculate_total(doc);
 }
 
@@ -84,9 +93,9 @@
 cur_frm.cscript.rate = cur_frm.cscript.qty;
 
 
-cur_frm.cscript.is_default = function(doc, dt, dn) {
+cur_frm.cscript.is_default = function(doc, cdt, cdn) {
 	if (doc.docstatus == 1)
-		$c_obj(make_doclist(dt, dn), 'manage_default_bom', '', '');
+		$c_obj(make_doclist(cdt, cdn), 'manage_default_bom', '', '');
 }
 
 
@@ -97,11 +106,11 @@
 
 
 // Calculate Operating Cost
-var calculate_op_cost = function(doc, dt, dn) {  
+var calculate_op_cost = function(doc, dt, dn) {	
 	var op = getchildren('BOM Operation', doc.name, 'bom_operations');
 	total_op_cost = 0;
 	for(var i=0;i<op.length;i++) {
-		op_cost =  flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60;
+		op_cost =	flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60;
 		set_multiple('BOM Operation',op[i].name, {'operating_cost': op_cost}, 'bom_operations');
 		total_op_cost += op_cost;
 	}
@@ -111,11 +120,11 @@
 
 
 // Calculate Raw Material Cost
-var calculate_rm_cost = function(doc, dt, dn) {  
+var calculate_rm_cost = function(doc, dt, dn) {	
 	var rm = getchildren('BOM Item', doc.name, 'bom_materials');
 	total_rm_cost = 0;
 	for(var i=0;i<rm.length;i++) {
-		amt =  flt(rm[i].rate) * flt(rm[i].qty);
+		amt =	flt(rm[i].rate) * flt(rm[i].qty);
 		set_multiple('BOM Item',rm[i].name, {'amount': amt}, 'bom_materials');
 		set_multiple('BOM Item',rm[i].name, {'qty_consumed_per_unit': flt(rm[i].qty)/flt(doc.quantity)}, 'bom_materials');
 		total_rm_cost += amt;
diff --git a/production/doctype/bom/bom.py b/production/doctype/bom/bom.py
index 0b634d7..ac21d21 100644
--- a/production/doctype/bom/bom.py
+++ b/production/doctype/bom/bom.py
@@ -31,7 +31,8 @@
 		self.doclist = doclist
 
 	def autoname(self):
-		last_name = sql("select max(name) from `tabBOM` where name like 'BOM/%s/%%'" % self.doc.item)
+		last_name = sql("""select max(name) from `tabBOM` 
+			where name like 'BOM/%s/%%'""" % self.doc.item)
 		if last_name:
 			idx = cint(cstr(last_name[0][0]).split('/')[-1]) + 1
 		else:
@@ -40,9 +41,10 @@
 
 
 	def get_item_det(self, item_code):
-		item = sql("""select name, is_asset_item, is_purchase_item, docstatus, is_sub_contracted_item,
-			description, stock_uom, default_bom, last_purchase_rate, standard_rate, is_manufactured_item from `tabItem` 
-			where item_code = %s""", item_code, as_dict = 1)
+		item = sql("""select name, is_asset_item, is_purchase_item, docstatus,
+		 	is_sub_contracted_item, description, stock_uom, default_bom, 
+			last_purchase_rate, standard_rate, is_manufactured_item 
+			from `tabItem` where item_code = %s""", item_code, as_dict = 1)
 
 		return item
 
@@ -84,10 +86,13 @@
 
 
 
-	def get_bom_material_detail(self, arg):
+	def get_bom_material_detail(self):
 		""" Get raw material details like uom, desc and rate"""
 
-		arg = eval(arg)
+		arg = webnotes.form_dict.get('args')
+		import json
+		arg = json.loads(arg)
+		
 		item = self.get_item_det(arg['item_code'])
 		self.validate_rm_item(item)
 		
@@ -96,10 +101,10 @@
 
 		rate = self.get_rm_rate(arg)
 		ret_item = {
-					 'description'  : item and arg['description'] or '',
-					 'stock_uom'	: item and arg['stock_uom'] or '',
-					 'bom_no'		: arg['bom_no'],
-					 'rate'			: rate
+			 'description'  : item and arg['description'] or '',
+			 'stock_uom'	: item and arg['stock_uom'] or '',
+			 'bom_no'		: arg['bom_no'],
+			 'rate'			: rate
 		}
 		return ret_item